Skip to content

Commit ee463c3

Browse files
committed
Keep testing sbom in Nuitka binary
1 parent d3b909a commit ee463c3

3 files changed

Lines changed: 14 additions & 9 deletions

File tree

changelog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
> This version is **not released yet** and is under active development.
77
88
- **Breaking:** [mpm] Rename the global `--stats / --no-stats` flag to `--summary / --no-summary`. Scripts passing the old flag must update.
9-
- **Breaking:** [mpm] Move `cyclonedx-python-lib` and `spdx-tools` into a new `[sbom]` extra: `mpm sbom` now requires `pip install meta-package-manager[sbom]`. `packageurl-python` stays in the runtime install.
9+
- **Breaking:** [mpm] Move `cyclonedx-python-lib` and `spdx-tools` into a new `[sbom]` extra: `mpm sbom` now requires `pip install meta-package-manager[sbom]`. `packageurl-python` stays in the runtime install. The standalone binary distribution keeps shipping SBOM support: `[tool.repomatic] nuitka.extras = ["sbom"]` syncs the extra into the build venv and `[tool.nuitka] include-package = ["cyclonedx", "spdx_tools"]` forces Nuitka to bundle the `try/except`-guarded imports.
1010
- [asdf] Add [asdf](https://asdf-vm.com) package manager (`installed`, `outdated`, `search`, `install`, `upgrade`, `upgrade_all`, `remove`, `sync`) on Linux and macOS; requires `asdf` `>=0.16.0`.
1111
- [mise] Add [mise](https://mise.jdx.dev) package manager (`installed`, `outdated`, `search`, `install`, `upgrade`, `upgrade_all`, `remove`, `sync`, `cleanup`), cross-platform; requires `mise` `>=2025.5.10`.
1212
- [mpm] Add the `--man` (roff man page) and `--accessible` (no ANSI or Unicode, for screen readers) global options from `click-extra`, and attach an `mpm-manpages.tar.gz` asset to each release.

pyproject.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,13 @@ macos-app-icon = "docs/assets/icon.icns"
292292
linux-icon = "docs/assets/icon.png"
293293
windows-icon-from-ico = "docs/assets/icon.ico"
294294
include-package-data = [ "click_extra" ]
295+
# The cyclonedx and spdx_tools imports are guarded behind try/except blocks in
296+
# meta_package_manager.sbom so a default `pip install` (without the [sbom]
297+
# extra) still imports cleanly. Nuitka skips packages whose imports are gated
298+
# behind try/except even when they are installed, so force-include them.
299+
# Pairs with `[tool.repomatic] nuitka.extras = ["sbom"]` which syncs the
300+
# packages into the build venv.
301+
include-package = [ "cyclonedx", "spdx_tools" ]
295302

296303
[tool.typos]
297304
# Correct capitalization for proper nouns.
@@ -471,6 +478,10 @@ test-matrix.remove.os = [ "windows-11-arm" ]
471478
test-matrix.exclude = [ { python-version = "3.15t" } ]
472479
# Test plan for binary testing.
473480
test-plan.file = "./tests/cli-test-plan.yaml"
481+
# Sync the [sbom] extra into the build venv so the Nuitka binary can ship
482+
# `mpm sbom --spdx` / `mpm sbom --cyclonedx`. Paired with `include-package`
483+
# in [tool.nuitka] below to defeat Nuitka's try/except import skip.
484+
nuitka.extras = [ "sbom" ]
474485
# Render the mpm Click command tree as roff `.1` files and attach them as
475486
# `mpm-manpages.tar.gz` to every GitHub release (handled by the `manpages` job
476487
# in repomatic's `_release-engine.yaml`). The `module:function` form bypasses

tests/cli-test-plan.yaml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -184,14 +184,8 @@
184184
- cli_parameters: backup
185185
exit_code: 0
186186

187-
# SBOM generation requires the [sbom] extra (cyclonedx-python-lib and
188-
# spdx-tools). The binary distribution mirrors a default `pip install
189-
# meta-package-manager` without extras, so `mpm sbom` exits with code 2 and
190-
# tells the user to install with `pip install meta-package-manager[sbom]`.
191187
- cli_parameters: sbom --spdx
192-
exit_code: 2
193-
stderr_contains: "SPDX SBOM generation requires the [sbom] extra"
188+
exit_code: 0
194189

195190
- cli_parameters: sbom --cyclonedx
196-
exit_code: 2
197-
stderr_contains: "CycloneDX SBOM generation requires the [sbom] extra"
191+
exit_code: 0

0 commit comments

Comments
 (0)