|
24 | 24 | from base64 import b64encode |
25 | 25 | from collections.abc import Generator |
26 | 26 | from os.path import dirname, join |
| 27 | +from pathlib import Path, PurePosixPath |
27 | 28 | from typing import TYPE_CHECKING, Any, AnyStr |
28 | | -from pathlib import PurePosixPath, Path |
29 | 29 |
|
30 | 30 | from cyclonedx.model import AttachedText, Encoding |
31 | 31 | from cyclonedx.model.license import DisjunctiveLicense, LicenseAcknowledgement |
@@ -69,7 +69,7 @@ def project2licenses(project: dict[str, Any], lfac: 'LicenseFactory', |
69 | 69 | continue |
70 | 70 | with plicense_fileh: |
71 | 71 | content = plicense_fileh.read() |
72 | | - yield _make_license_from_content('/'.join(Path(plfile).parts), content, lack) |
| 72 | + yield _make_license_from_content(plfile, content, lack) |
73 | 73 | # Silently skip any other types (including string/PEP 621) |
74 | 74 | return None |
75 | 75 |
|
@@ -125,7 +125,7 @@ def _make_license_from_content(file_name: str, content: AnyStr, lack: 'LicenseAc |
125 | 125 | else content.encode('utf-8') |
126 | 126 | ).decode('ascii') |
127 | 127 | return DisjunctiveLicense( |
128 | | - name=f'{lack.value} license file: {file_name}', |
| 128 | + name=f'{lack.value} license file: {'/'.join(Path(file_name).parts)}', |
129 | 129 | acknowledgement=lack, |
130 | 130 | text=AttachedText( |
131 | 131 | content=content_s, |
|
0 commit comments