Skip to content

Commit 330d161

Browse files
committed
wip
Signed-off-by: Jan Kowalleck <[email protected]>
1 parent 0ba2ee7 commit 330d161

11 files changed

+6
-66
lines changed

cyclonedx_py/_internal/utils/pep621.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,12 @@ def project2licenses(project: dict[str, Any], lfac: 'LicenseFactory',
8383
elif len(plicense_text := plicense.get('text', '')) > 0:
8484
license = lfac.make_from_string(plicense_text,
8585
license_acknowledgement=lack)
86-
if isinstance(license, DisjunctiveLicense) and license.id is None and gather_text:
87-
# per spec, `License` is either a SPDX ID/Expression, or a license text(not name!)
88-
yield DisjunctiveLicense(name=f"declared license of '{project['name']}'",
89-
acknowledgement=lack,
90-
text=AttachedText(content=plicense_text))
86+
if isinstance(license, DisjunctiveLicense) and license.id is None:
87+
if gather_text:
88+
# per spec, `License` is either a SPDX ID/Expression, or a license text(not name!)
89+
yield DisjunctiveLicense(name=f"declared license of '{project['name']}'",
90+
acknowledgement=lack,
91+
text=AttachedText(content=plicense_text))
9192
else:
9293
yield license
9394
# Silently skip any other types (including string/PEP 639)

tests/_data/snapshots/environment/plain_with-license-text_1.2.json.bin

Lines changed: 0 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/_data/snapshots/environment/plain_with-license-text_1.2.xml.bin

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/_data/snapshots/environment/plain_with-license-text_1.3.json.bin

Lines changed: 0 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/_data/snapshots/environment/plain_with-license-text_1.3.xml.bin

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/_data/snapshots/environment/plain_with-license-text_1.4.json.bin

Lines changed: 0 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/_data/snapshots/environment/plain_with-license-text_1.4.xml.bin

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/_data/snapshots/environment/plain_with-license-text_1.5.json.bin

Lines changed: 0 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/_data/snapshots/environment/plain_with-license-text_1.5.xml.bin

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/_data/snapshots/environment/plain_with-license-text_1.6.json.bin

Lines changed: 0 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)