python27/python-2.7-macros.python

27 lines
1.3 KiB
Plaintext
Raw Normal View History

%__python27 /usr/bin/python2.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}.
%__python27_provides %{_usrlibrpm}/pythondeps27.sh --provides
%__python27_requires %{_usrlibrpm}/pythondeps27.sh --requires
# Useful macros for building *.rpm python packages (for python > 1.6).
#
%python27_sitearch %(%{__python27} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")
%python27_sitelib %(%{__python27} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")
%python27_version %(%{__python27} -c "import sys; print(sys.version[0:3])")
%py27_compile(O) \
find %1 -name '*.pyc' -name '*.pyo' -exec rm -f {} \\; \
%{__python27} %{?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 \
%py27_requires(d) \
%define maxver %(%{__python27} -c "import sys; a,b=sys.version_info[:2]; print '%%d.%%d'%%(a,b+1)" 2>/dev/null || echo PYTHON-NOT-FOUND) \
BuildRequires: python27, libpython27-devel \
PreReq: python27 >= %{python27_version}, python27 < %{maxver}