Skip to content

Commit 8453448

Browse files
committed
Ensure package resource is tagged #2929
* Set the for_packages field for the package manifest resource whenever we are in the situation where we scan a single file that is a package manifest Signed-off-by: Jono Yang <[email protected]>
1 parent faa9286 commit 8453448

File tree

3 files changed

+17
-12
lines changed

3 files changed

+17
-12
lines changed

src/packagedcode/npm.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ def assemble(cls, package_data, resource, codebase):
9292
npm_res.for_packages.append(package_uid)
9393
npm_res.save(codebase)
9494
yield npm_res
95+
elif codebase.has_single_resource:
96+
if package_uid not in package_resource.for_packages:
97+
package_resource.for_packages.append(package_uid)
98+
package_resource.save(codebase)
99+
yield package_resource
95100

96101
yield package
97102
else:

tests/licensedcode/data/plugin_license/package/package.expected.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,15 @@
1212
"output_format_version": "2.0.0",
1313
"message": null,
1414
"errors": [],
15+
"warnings": [],
1516
"extra_data": {
17+
"system_environment": {
18+
"operating_system": "linux",
19+
"cpu_architecture": "64",
20+
"platform": "Linux-5.4.0-107-generic-x86_64-with-Ubuntu-18.04-bionic",
21+
"platform_version": "#121~18.04.1-Ubuntu SMP Thu Mar 24 17:21:33 UTC 2022",
22+
"python_version": "3.6.9 (default, Mar 15 2022, 13:55:28) \n[GCC 8.4.0]"
23+
},
1624
"spdx_license_list_version": "3.16",
1725
"files_count": 1
1826
}

tests/packagedcode/data/pypi/source-package/pip-22.0.4-pypi-package-expected.json

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -399,24 +399,16 @@
399399
{
400400
"type": "pypi",
401401
"namespace": null,
402-
"name": "",
403-
"version": "",
402+
"name": null,
403+
"version": null,
404404
"qualifiers": {},
405405
"subpath": null,
406406
"primary_language": "Python",
407407
"description": null,
408408
"release_date": null,
409-
"parties": [
410-
{
411-
"type": "person",
412-
"role": "author",
413-
"name": null,
414-
"email": null,
415-
"url": null
416-
}
417-
],
409+
"parties": [],
418410
"keywords": [],
419-
"homepage_url": "",
411+
"homepage_url": null,
420412
"download_url": null,
421413
"size": null,
422414
"sha1": null,

0 commit comments

Comments
 (0)