Skip to content

Commit 345241c

Browse files
committed
wip
Signed-off-by: Jan Kowalleck <[email protected]>
1 parent 59fd13d commit 345241c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

cyclonedx_py/_internal/utils/pep639.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
from collections.abc import Generator
2626
from os.path import dirname, join
2727
from typing import TYPE_CHECKING, Any, AnyStr
28+
from pathlib import PurePosixPath, Path
2829

2930
from cyclonedx.model import AttachedText, Encoding
3031
from cyclonedx.model.license import DisjunctiveLicense, LicenseAcknowledgement
@@ -55,7 +56,7 @@ def project2licenses(project: dict[str, Any], lfac: 'LicenseFactory',
5556
# https://peps.python.org/pep-0639/#add-license-files-key
5657
plfiles_root = dirname(fpath)
5758
for plfile_glob in plfiles:
58-
for plfile in glob(plfile_glob, root_dir=plfiles_root, recursive=True):
59+
for plfile in glob(join(*PurePosixPath(plfile_glob).parts), root_dir=plfiles_root, recursive=True):
5960
# per spec:
6061
# > Tools MUST assume that license file content is valid UTF-8 encoded text
6162
# anyway, we don't trust this and assume binary
@@ -68,7 +69,7 @@ def project2licenses(project: dict[str, Any], lfac: 'LicenseFactory',
6869
continue
6970
with plicense_fileh:
7071
content = plicense_fileh.read()
71-
yield _make_license_from_content(plfile, content, lack)
72+
yield _make_license_from_content('/'.join(Path(plfile).parts), content, lack)
7273
# Silently skip any other types (including string/PEP 621)
7374
return None
7475

0 commit comments

Comments
 (0)