| 1 |
From: Felix Moessbauer <[email protected]> |
| 2 |
Date: Mon, 2 Mar 2026 10:53:03 +0100 |
| 3 |
Subject: debian-only: provide debian package name in error message |
| 4 |
|
| 5 |
The spdx and CycloneDX libraries are optional, but when an operation is |
| 6 |
requested that requires either of them, an error message is shown how to |
| 7 |
install it. Upstream reports this by printing the pip install commands, |
| 8 |
however as we are on Debian, people should use the packages from the |
| 9 |
distro. |
| 10 |
|
| 11 |
We change the hint to display the Debian package names. |
| 12 |
|
| 13 |
Signed-off-by: Felix Moessbauer <[email protected]> |
| 14 |
|
| 15 |
Forwarded: not-needed |
| 16 |
--- |
| 17 |
src/debsbom/commands/generate.py | 3 +-- |
| 18 |
src/debsbom/sbom.py | 6 ++---- |
| 19 |
2 files changed, 3 insertions(+), 6 deletions(-) |
| 20 |
|
| 21 |
diff --git a/src/debsbom/commands/generate.py b/src/debsbom/commands/generate.py |
| 22 |
index bb5240d..c9615b5 100644 |
| 23 |
--- a/src/debsbom/commands/generate.py |
| 24 |
+++ b/src/debsbom/commands/generate.py |
| 25 |
@@ -33,8 +33,7 @@ class GenerateCmd(GenerateInput): |
| 26 |
if sbom_types == []: |
| 27 |
raise RuntimeError( |
| 28 |
"Cannot generate any SBOM because no SBOM format dependencies are available. " |
| 29 |
- "Install them by enabling the dependency extras `cdx` and/or `spdx`: " |
| 30 |
- "`pip install debsbom[spdx]`, `pip install debsbom[cdx]`." |
| 31 |
+ "Install the package `python3-spdx-tools` and / or `python3-cyclonedx-lib`." |
| 32 |
) |
| 33 |
else: |
| 34 |
sbom_types: list[SBOMType] = [SBOMType.from_str(stype) for stype in args.sbom_type] |
| 35 |
diff --git a/src/debsbom/sbom.py b/src/debsbom/sbom.py |
| 36 |
index bda1f5b..7c2b387 100644 |
| 37 |
--- a/src/debsbom/sbom.py |
| 38 |
+++ b/src/debsbom/sbom.py |
| 39 |
@@ -75,16 +75,14 @@ class SBOMType(Enum): |
| 40 |
import cyclonedx.model.component |
| 41 |
except ModuleNotFoundError as e: |
| 42 |
raise RuntimeError( |
| 43 |
- "Missing dependency: cyclonedx-python-lib; install it by enabling the" |
| 44 |
- "dependency extra `cdx`: `pip install debsbom[cdx]`" |
| 45 |
+ "Missing dependency: cyclonedx-python-lib from package `python3-cyclonedx-lib`" |
| 46 |
) |
| 47 |
elif self == SBOMType.SPDX: |
| 48 |
try: |
| 49 |
import spdx_tools.spdx.model.package |
| 50 |
except ModuleNotFoundError as e: |
| 51 |
raise RuntimeError( |
| 52 |
- "Missing dependency: spdx-tools; install it by enabling the" |
| 53 |
- "dependency extra `spdx`: `pip install debsbom[spdx]`" |
| 54 |
+ "Missing dependency: spdx-tools from package `python3-spdx-tools`" |
| 55 |
) |
| 56 |
|
| 57 |
|