Add support PEP 770 (SBOMs)#843
Conversation
pre-commit.ci on mesonbuild#843 surfaced two issues: - ruff I001: generate.py was missing the blank line required by the repo's lines-after-imports = 2 isort setting. - reuse lint: extra.txt had no copyright/licensing information. Adding sidecar .license files is the repo's established pattern for plain-text fixtures (see tests/packages/install-data/data.txt.license). Also add sidecars for the two static.cdx.json fixtures for good measure -- CI didn't flag them but local reuse runs do. Both are one-line sidecars matching the rest of the repo's style.
This is a scaffold commit so CI can resolve the build dependency against mesonbuild/meson-python#843 while that PR is under review. The pandas SBOM routing relies on path-prefix detection added in that meson-python branch; once it lands in a released meson-python (0.20.0 or later), this commit should be dropped and the "meson-python>=0.20.0,<1" pin restored. NOT FOR MERGE.
|
Thanks @fangchenli, this looks pretty comprehensive. I'll have to think about this a bit longer, in particular whether the targeting of the I'll cross-link mesonbuild/meson#15738 for the idea of adding a custom Meson install tag, which is still in the commit history here but you dropped (and that decision looks correct to me). |
|
I'll also explicitly cross-link this comment from @eli-schwartz ("It may be separately interesting to teach meson about SBOM files, ...". That does make sense, but nothing in this PR is dependent on that or adds something public that would need removing if Meson adds SBOM support in the future. |
|
I had a quick look at this. First, please squash the commits into a set of logical changes, we are not interested in how we arrived at the current form of the code and separate commits in a PR should only be used to separate changes in self contained bites easier to review. Second, I am not sure I like the shape of this. The main objection is that this works for when producing a wheel. However, there are many projects that use meson (without meson-python) to directly install. In this case there would be an undesirable A better solution that comes to mind is to have a [project]
name = 'foo'
[tool.meson-python]
sboms = ['{datadir}/foo/sboms/*']which mimics This scheme can maybe further extended to pick files from the source directory when the glob pattern specified in |
|
Maybe the setting name should be |
Well, this does remind me that there are several projects which produce C libraries and also (optionally?) python bindings, and not the ctypes variety. For wheels, it's potentially desirable to statically link and/or not waste time building stuff that won't ever go into a wheel. I added a -Dwheel-only=true option to https://github.com/dgibson/dtc/blob/main/pyproject.toml#L24 |
Add a tool.meson-python.sbom-files setting listing glob patterns
matched against the file installation paths as they appear in the
Meson introspection data. Matching files are moved to the
.dist-info/sboms/ directory in the wheel, the location defined by
PEP 770 for SBOM documents describing the package contents.
The default pattern is '{datadir}/{name}/sboms/*', with {name} the
normalized project name. Anchoring the patterns in the data directory
means that, when the Meson project is installed directly rather than
through a Python build front-end, the SBOM files are installed as
regular data files and no spurious .dist-info directory is created.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2aac893 to
aec61d3
Compare
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
aec61d3 to
36c4818
Compare
closes #763