RPM Macro Expansion in Python
Parse RPM macro files and spec files, and expand macros safely—without the potential Turing-Complete side effects.
This is a standalone library that depends only on the standard Python library and lark (for expression parsing).
How to Use It
$ norpm-expand-specfile --specfile SPEC --expand-string '%{?epoch}%{!?epoch:(none)}:%version'
(none):1.1.1
Directly from Python, you can use:
from norpm.macrofile import system_macro_registry
from norpm.specfile import specfile_expand
registry = system_macro_registry()
with open("SPEC", "r", encoding="utf8") as fd:
expanded_specfile = specfile_expand(fd.read(), registry)
print("Name:", registry["name"].value)
print("Version:", registry["version"].value)
Changes
See NEWS.md for the release history.
State of the implementation
There still are a few features to be implemented. Your contributions are welcome and greatly encouraged!
Metadata
Release files for norpm 1.11
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| norpm-1.11.tar.gz | 57.8 kB | Without provenance | Details for norpm-1.11.tar.gz |
Release files / norpm-1.11.tar.gz
| Download URL | norpm-1.11.tar.gz |
|---|---|
| Size | 57.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a556e65415706a64b25b0d483ddfc8aa7ae0e9530135bd94f6656d0720a2614a
|
|
BLAKE2b-256 checksum How to use checksums |
d2a34022151c123519cf39e3b0ae43ccb2b31fad0b491c650ba73d0ada1b42ae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.4
|
Security for norpm 1.11
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.