@@ -188,9 +188,13 @@ def generate_output(results, license_references, version, template):
188188 """
189189 # FIXME: This code is highly coupled with actual scans and may not
190190 # support adding new scans at all
191+
192+ from licensedcode .cache import get_licenses_db
193+
191194 converted = {}
192195 converted_infos = {}
193196 converted_packages = {}
197+ licenses = {}
194198
195199 LICENSES = 'license_detections'
196200 COPYRIGHTS = 'copyrights'
@@ -223,6 +227,11 @@ def generate_output(results, license_references, version, template):
223227 'value' : license_expression ,
224228 })
225229
230+ if not license_references and license_expression not in licenses :
231+ license_object = get_licenses_db ().get (license_expression )
232+ if license_object != None :
233+ licenses [license_expression ] = license_object
234+
226235 if results :
227236 converted [path ] = sorted (results , key = itemgetter ('start' ))
228237
@@ -239,6 +248,10 @@ def generate_output(results, license_references, version, template):
239248 if PACKAGES in scanned_file :
240249 converted_packages [path ] = scanned_file [PACKAGES ]
241250
251+ if not license_references :
252+ licenses = dict (sorted (licenses .items ()))
253+ license_references = list (licenses .values ())
254+
242255 files = {
243256 'license_copyright' : converted ,
244257 'infos' : converted_infos ,
0 commit comments