Skip to content

Commit 8c15bc7

Browse files
committed
fix(getdependencies python): getdependencies python writes now correct package names **with dashed** in the SBOM
1 parent 5168581 commit 8c15bc7

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
* Adapt `getdependencies python` to the Poetry 2.x pyproject.toml format.
2424
* `getdependencies python` now also supports uv and its `uv.lock` file.
2525
* Have correct `file:///` uri for files in SBOM external references.
26+
* `getdependencies python` writes now correct package names **with dashed** in the SBOM.
2627

2728
## 2.9.1
2829

capycli/dependencies/python.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def normalize_packagename(name: str) -> str:
8181
see https://packaging.python.org/en/latest/specifications/name-normalization/#name-normalization
8282
"""
8383
_NORMALIZE_MATCHER = compile(r"[-_.]+")
84-
return _NORMALIZE_MATCHER.sub("_", name.lower())
84+
return _NORMALIZE_MATCHER.sub("-", name.lower())
8585

8686
def requirements_to_package_list(self, input_file: str) -> List[Dict[str, str]]:
8787
"""

tests/test_get_dependencies_python.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ def test_process_poetry_1_4_0_lock(self) -> None:
411411
out = self.capture_stdout(sut.run, args)
412412
# self.dump_textfile(out, "DUMP.TXT")
413413
self.assertTrue("Checking meta-data:" in out)
414-
self.assertTrue("cli_support" in out)
414+
self.assertTrue("cli-support" in out)
415415
self.assertTrue(self.OUTPUTFILE2 in out)
416416
self.assertTrue("30 components items written to file." in out)
417417

@@ -444,7 +444,7 @@ def test_process_poetry_1_8_3_lock(self) -> None:
444444
out = self.capture_stdout(sut.run, args)
445445
# self.dump_textfile(out, "DUMP.TXT")
446446
self.assertTrue("Checking meta-data:" in out)
447-
self.assertTrue("cli_support" in out)
447+
self.assertTrue("cli-support" in out)
448448
self.assertTrue(self.OUTPUTFILE2 in out)
449449
# for the real version 2.6.0 source code it would be 39 components,
450450
# but for the test the umber is different
@@ -479,7 +479,7 @@ def test_process_poetry_2_1_4_lock(self) -> None:
479479
out = self.capture_stdout(sut.run, args)
480480
# self.dump_textfile(out, "DUMP.TXT")
481481
self.assertTrue("Checking meta-data:" in out)
482-
self.assertTrue("cli_support, 2.0.1" in out)
482+
self.assertTrue("cli-support, 2.0.1" in out)
483483
self.assertTrue(self.OUTPUTFILE2 in out)
484484
# for the real version 2.6.0 source code it would be 39 components,
485485
# but for the test the number is different
@@ -514,7 +514,7 @@ def test_process_uv_1_3_lock(self) -> None:
514514
out = self.capture_stdout(sut.run, args)
515515
# self.dump_textfile(out, "DUMP.TXT")
516516
self.assertTrue("Checking meta-data:" in out)
517-
self.assertTrue("cli_support, 2.0.1" in out)
517+
self.assertTrue("cli-support, 2.0.1" in out)
518518
self.assertTrue(self.OUTPUTFILE2 in out)
519519
self.assertTrue(" components items written to file." in out)
520520

0 commit comments

Comments
 (0)