Skip to content

Commit 6107d33

Browse files
committed
Fixed source filtering bug for spdx conversion
1 parent ff6b8f7 commit 6107d33

File tree

4 files changed

+18
-5
lines changed

4 files changed

+18
-5
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99
### Added
1010
- Upcoming changes...
1111

12+
## [1.37.1] - 2025-10-21
13+
### Added
14+
- Added source filtering to cyclonedx conversion
15+
### Fixed
16+
- Fixed dependencies being skipped during spdx conversion
17+
1218
## [1.37.0] - 2025-10-17
1319
### Added
1420
- Added delta folder and file copy command
@@ -689,3 +695,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
689695
[1.35.0]: https://github.com/scanoss/scanoss.py/compare/v1.34.0...v1.35.0
690696
[1.36.0]: https://github.com/scanoss/scanoss.py/compare/v1.35.0...v1.36.0
691697
[1.37.0]: https://github.com/scanoss/scanoss.py/compare/v1.36.0...v1.37.0
698+
[1.37.1]: https://github.com/scanoss/scanoss.py/compare/v1.37.0...v1.37.1

src/scanoss/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@
2222
THE SOFTWARE.
2323
"""
2424

25-
__version__ = '1.37.0'
25+
__version__ = '1.37.1'

src/scanoss/cyclonedx.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,11 @@ def parse(self, data: dict): # noqa: PLR0912, PLR0915
152152
fdl = []
153153
if licenses:
154154
for lic in licenses:
155-
fdl.append({'id': lic.get('name')})
155+
name = lic.get('name')
156+
source = lic.get('source')
157+
if source not in ('component_declared', 'license_file', 'file_header'):
158+
continue
159+
fdl.append({'id': name})
156160
fd['licenses'] = fdl
157161
cdx[purl] = fd
158162
# self.print_stderr(f'VD: {vdx}')
@@ -295,7 +299,8 @@ def produce_from_str(self, json_str: str, output_file: str = None) -> bool:
295299
except Exception as e:
296300
self.print_stderr(f'ERROR: Problem parsing input JSON: {e}')
297301
return False
298-
return self.produce_from_json(data, output_file)
302+
success, _ = self.produce_from_json(data, output_file)
303+
return success
299304

300305
def _normalize_vulnerability_id(self, vuln: dict) -> tuple[str, str]:
301306
"""

src/scanoss/spdxlite.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,9 @@ def _process_licenses(self, licenses: list) -> list:
247247
for license_info in licenses:
248248
name = license_info.get('name')
249249
source = license_info.get('source')
250-
if source not in ("component_declared", "license_file", "file_header"):
251-
continue
250+
if source is not None or source == '':
251+
if source not in ("component_declared", "license_file", "file_header"):
252+
continue
252253
if name and name not in seen_names:
253254
processed_licenses.append({'id': name})
254255
seen_names.add(name)

0 commit comments

Comments
 (0)