Add unversioned python macros

These macros are taken from fpc#281 and fpc#534 and the python-devel package
requires it.
This commit is contained in:
Thomas Spura 2015-06-25 18:59:04 +02:00
parent a8af8d5b71
commit 965c95ee11
3 changed files with 75 additions and 1 deletions

38
macros.python Normal file
View File

@ -0,0 +1,38 @@
%py_setup setup.py
%py_shbang_opts -s
%py_build() %{expand:\
CFLAGS="%{optflags}" %{__python} %{py_setup} %{?py_setup_args} build --executable="%{__python2} %{py_shbang_opts}" %{?1}\
}
%py_install() %{expand:\
CFLAGS="%{optflags}" %{__python} %{py_setup} %{?py_setup_args} install -O1 --skip-build --root %{buildroot} %{?1}\
}
%python_provide() %{lua:\
function string.starts(String,Start)\
return string.sub(String,1,string.len(Start))==Start\
end\
str = rpm.expand("%{?1:%{1}}");\
vr = rpm.expand("%{version}-%{release}")
if (string.starts(str, "python2-")) then\
print("Provides: python-");\
print(string.sub(str,9,string.len(str)));\
elseif (string.starts(str, "python3-")) then\
--No unversioned provides as python3 is not default\
elseif (string.starts(str, "pypy-")) then\
--No unversioned provides as pypy is not default\
elseif (string.starts(str, "pypy3-")) then\
--No unversioned provides as pypy is not default\
elseif (string.starts(str, "python-")) then\
--Providing the current default python\
print("Provides: python2-");\
print(string.sub(str,9,string.len(str)));\
else\
print("ERROR: ");\
print(str);\
print("not recognized.");\
end\
print(" = ");\
print(vr);\
}

View File

@ -3,3 +3,13 @@
%python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")
%python2_version %(%{__python2} -c "import sys; sys.stdout.write('{0.major}.{0.minor}'.format(sys.version_info))")
%python2_version_nodots %(%{__python2} -c "import sys; sys.stdout.write('{0.major}{0.minor}'.format(sys.version_info))")
%py2_shbang_opts -s
%py2_build() %{expand:\
CFLAGS="%{optflags}" %{__python2} %{py_setup} %{?py_setup_args} build --executable="%{__python2} %{py2_shbang_opts}" %{?1}\
}
%py2_install() %{expand:\
CFLAGS="%{optflags}" %{__python2} %{py_setup} %{?py_setup_args} install -O1 --skip-build --root %{buildroot} %{?1}\
}

View File

@ -108,7 +108,7 @@ Summary: An interpreted, interactive, object-oriented programming language
Name: %{python}
# Remember to also rebase python-docs when changing this:
Version: 2.7.10
Release: 2%{?dist}
Release: 3%{?dist}
License: Python
Group: Development/Languages
Requires: %{python}-libs%{?_isa} = %{version}-%{release}
@ -207,6 +207,10 @@ Source6: macros.python2
Source7: pynche
# Supply version independent macros such as python_provide, py_build and
# py_install
Source8: macros.python
# Modules/Setup.dist is ultimately used by the "makesetup" script to construct
# the Makefile and config.c
#
@ -1014,6 +1018,7 @@ a scripting language, and by the main "python" executable
Summary: The libraries and header files needed for Python development
Group: Development/Libraries
Requires: %{python}%{?_isa} = %{version}-%{release}
Requires: python-macros = %{version}-%{release}
Requires: pkgconfig
# Needed here because of the migration of Makefile from -devel to the main
# package
@ -1035,6 +1040,18 @@ python package will also need to be installed. You'll probably also
want to install the python-docs package, which contains Python
documentation.
%package -n python-macros
Summary: The unversioned Python RPM macros
Group: Development/Libraries
Requires: %{python} = %{version}-%{release}
%description -n python-macros
This package contains the unversioned Python RPM macros, that most
implementations should rely on.
You should not need to install this package manually as the various
python?-devel packages require it. So install a python-devel package instead.
%package tools
Summary: A collection of development tools included with Python
Group: Development/Tools
@ -1638,6 +1655,7 @@ sed -i -e "s/'pyconfig.h'/'%{_pyconfig_h}'/" \
# Install macros for rpm:
mkdir -p %{buildroot}/%{_rpmconfigdir}/macros.d/
install -m 644 %{SOURCE6} %{buildroot}/%{_rpmconfigdir}/macros.d/
install -m 644 %{SOURCE8} %{buildroot}/%{_rpmconfigdir}/macros.d/
# Ensure that the curses module was linked against libncursesw.so, rather than
# libncurses.so (bug 539917)
@ -1952,6 +1970,10 @@ rm -fr %{buildroot}
%{_libdir}/libpython%{pybasever}.so
%{_rpmconfigdir}/macros.d/macros.python2
%files -n python-macros
%defattr(-,root,root,-)
%{_rpmconfigdir}/macros.d/macros.python
%files tools
%defattr(-,root,root,755)
%doc Tools/pynche/README.pynche
@ -2133,6 +2155,10 @@ rm -fr %{buildroot}
# ======================================================
%changelog
* Thu Jun 25 2015 Thomas Spura <tomspur@fedoraproject.org> - 2.7.10-3
- Add unversioned python macros from fpc#281 and fpc#534
and require it from python-devel
* Wed Jun 17 2015 Matej Stuchlik <mstuchli@redhat.com> - 2.7.10-2
- Make relocating Python by changing _prefix actually work
Resolves: rhbz#1231801