Define %python_sitelib, %python_sitearch, %python_version, %python_version_nodots

In rpm 4.15 those are no longer defined.

The meaning of "python" is derived from %__python - and that errors by default
unless user defined.

Example usage:

    %global __python /usr/bin/pypy3

    ...

    %files
    %{python_sitelib}/foo/
This commit is contained in:
Miro Hrončok 2019-06-10 14:45:52 +02:00
parent 813a86fcc6
commit d38048d54d
2 changed files with 13 additions and 1 deletions

View File

@ -1,3 +1,10 @@
# unversioned macros: used with user defined __python, no longer part of rpm >= 4.15
%__python %{error:attempt to use unversioned python, define %%__python to %{_bindir}/python2 or %{_bindir}/python3 explicitly}
%python_sitelib %(%{__python} -Esc "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
%python_sitearch %(%{__python} -Esc "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")
%python_version %(%{__python} -Esc "import sys; sys.stdout.write('{0.major}.{0.minor}'.format(sys.version_info))")
%python_version_nodots %(%{__python} -Esc "import sys; sys.stdout.write('{0.major}{0.minor}'.format(sys.version_info))")
%py_setup setup.py
%py_shbang_opts -s

View File

@ -1,6 +1,6 @@
Name: python-rpm-macros
Version: 3
Release: 42%{?dist}
Release: 43%{?dist}
Summary: The unversioned Python RPM macros
License: MIT
@ -73,6 +73,11 @@ install -m 644 %{SOURCE0} %{SOURCE1} %{SOURCE2} %{SOURCE3} %{SOURCE4} \
%changelog
* Mon Jun 10 2019 Miro Hrončok <mhroncok@redhat.com> - 3-43
- Define %%python_sitelib, %%python_sitearch, %%python_version, %%python_version_nodots,
in rpm 4.15 those are no longer defined, the meaning of python is derived from %%__python.
- Usage of %%__python or the above-mentioned macros will error unless user defined.
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3-42
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild