7.2. Common macros for Python 3 RPMs
In a Python RPM spec file, always use the macros for Python 3 RPMs rather than hardcoding their values.
You can redefine which Python 3 version is used in these macros by defining the python3_pkgversion macro on top of your spec file. For more information, see A spec file description for an example Python package. If you define the python3_pkgversion macro, the values of the macros described in the following table will reflect the specified Python 3 version.
| Macro | Normal Definition | Description |
|---|---|---|
| %{python3_pkgversion} | 3 | The Python version that is used by all other macros. Can be redefined to any future Python versions that will be added. |
| %{python3} | /usr/bin/python3 | The Python 3 interpreter. |
| %{python3_version} | 3.12 | The major.minor version of the Python 3 interpreter. |
| %{python3_sitelib} | /usr/lib/python3.12/site-packages | The location where pure-Python modules are installed. |
| %{python3_sitearch} | /usr/lib64/python3.12/site-packages | The location where modules containing architecture-specific extension modules are installed. |
| %py3_build |
Expands to the | |
| %py3_install |
Expands to the | |
| %{py3_shebang_flags} | sP |
The default set of flags for the Python interpreter directives macro, |
| %py3_shebang_fix |
Changes Python interpreter directives to |