python37/macros.python37

27 lines
1.4 KiB
Plaintext

%__python37 /usr/bin/python3.7
#------------------------------------------------------------------------
# python(...) configuration.
#
# Path to scripts to autogenerate python package dependencies,
#
# Note: Used iff _use_internal_dependency_generator is non-zero. The
# helpers are also used by %{_usrlibrpm}/rpmdeps {--provides|--requires}.
%__python37_provides %{_usrlibrpm}/pythondeps37.sh --provides
%__python37_requires %{_usrlibrpm}/pythondeps37.sh --requires
# Useful macros for building *.rpm python packages (for python > 1.6).
#
%python37_sitearch %(%{__python37} -c "from sysconfig import get_paths; print(get_paths()['platlib'])")
%python37_sitelib %(%{__python37} -c "from sysconfig import get_paths; print(get_paths()['purelib'])")
%python37_inc %(%{__python37} -c "from sysconfig import get_paths; print(get_paths()['include'])")
%python37_version %(%{__python37} -c "import sys; print(sys.version[0:3])")
%py37_compile(O) \
find %1 -name '*.pyc' -name '*.pyo' -exec rm -f {} \\; \
%{__python37} %{?O:-O} -c "import sys, os, compileall; br='%{buildroot}'; compileall.compile_dir(sys.argv[1], ddir=br and (sys.argv[1][len(os.path.abspath(br)):]+'/') or None)" %1 \
%py37_requires(d) \
%define maxver %(%{__python37} -c "import sys; a,b=sys.version_info[:2]; print('%%d.%%d'%%(a,b+1))" 2>/dev/null || echo PYTHON-NOT-FOUND) \
BuildRequires: python37, libpython37-devel \
Requires(pre): python37 >= %{python37_version}, python37 < %{maxver}