python310/macros.python310

27 lines
1.4 KiB
Plaintext
Raw Normal View History

%__python310 /usr/bin/python3.10
#------------------------------------------------------------------------
# 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}.
%__python310_provides %{_usrlibrpm}/pythondeps310.sh --provides
%__python310_requires %{_usrlibrpm}/pythondeps310.sh --requires
# Useful macros for building *.rpm python packages (for python > 1.6).
#
%python310_sitearch %(%{__python310} -c "from sysconfig import get_paths; print(get_paths()['platlib'])")
%python310_sitelib %(%{__python310} -c "from sysconfig import get_paths; print(get_paths()['purelib'])")
%python310_inc %(%{__python310} -c "from sysconfig import get_paths; print(get_paths()['include'])")
%python310_version %(%{__python310} -c "import sys; print(sys.version[0:4])")
%py310_compile(O) \
find %1 -name '*.pyc' -name '*.pyo' -exec rm -f {} \\; \
%{__python310} %{?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 \
%py310_requires(d) \
%define maxver %(%{__python310} -c "import sys; a,b=sys.version_info[:2]; print('%%d.%%d'%%(a,b+1))" 2>/dev/null || echo PYTHON-NOT-FOUND) \
BuildRequires: python310, libpython310-devel \
Requires(pre): python310 >= %{python310_version}, python310 < %{maxver}