python27/python-macros.python

48 lines
2.2 KiB
Plaintext
Raw Permalink Normal View History

%__python /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}.
%__python_provides %{_usrlibrpm}/pythondeps.sh --provides
%__python_requires %{_usrlibrpm}/pythondeps.sh --requires
# Useful macros for building *.rpm python packages (for python > 1.6).
#
%python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")
%python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")
%python_inc %(%{__python} -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())")
%python_version %(%{__python} -c "import sys; print(sys.version[0:3])")
%py_compile(O) \
find %1 -name '*.pyc' -name '*.pyo' -exec rm -f {} \\; \
%{__python} %{?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 \
%py_requires(d) \
%define maxver %(%{__python} -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 >= %{python_version}, python < %{maxver}
%pyver_package \
%define pyver %{with_pyver} \
%define pyappend py%{with_pyver} \
%define __python %(rpm --eval %{__python%{pyver}}) \
%define python_sitearch %(rpm --eval %{python%{with_pyver}_sitearch}) \
%define python_sitelib %(rpm --eval %{python%{with_pyver}_sitelib}) \
%define python_inc %(rpm --eval %{python%{with_pyver}_inc}) \
%define python_version %(rpm --eval %{python%{with_pyver}_version}) \
%define python_provides %(rpm --eval %{python%{with_pyver}_provides}) \
%define python_requires %(rpm --eval %{python%{with_pyver}_requires}) \
%define py_requires %(rpm --eval %{py%{with_pyver}_requires}) \
\
%package %{pyappend} \
Group: System/Libraries/Python \
Summary: %{summary} \
%py_requires \
\
%description %{pyappend} \
%{summary} \