From 492bd7e60e0565192f8b6d28459b7cb511ad53da Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Fri, 10 Feb 2017 18:35:00 -0800 Subject: [PATCH] Enable Python 3 build for EL 6+ --- python-productmd.spec | 43 ++++++++++++++++++------------------------- 1 file changed, 18 insertions(+), 25 deletions(-) diff --git a/python-productmd.spec b/python-productmd.spec index 41ee5b6..991d07e 100644 --- a/python-productmd.spec +++ b/python-productmd.spec @@ -1,25 +1,15 @@ -%global with_python3 1 - -%if 0%{?fedora} && 0%{?fedora} <= 12 -%global with_python3 0 +# Enable Python 3 builds for Fedora + EPEL >5 +%if 0%{?fedora} || 0%{?rhel} > 5 +# If the definition isn't available for python3_pkgversion, define it +%{?!python3_pkgversion:%global python3_pkgversion 3} +%bcond_without python3 +%else +%bcond_with python3 %endif -%if 0%{?rhel} && 0%{?rhel} <= 7 -%{!?__python2: %global __python2 /usr/bin/python2} -%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} -%global with_python3 0 -%endif - -# compatibility with older releases -%{!?__python2: %global __python2 /usr/bin/python2} -%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} -%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} -%{!?py2_build: %global py2_build %{expand: CFLAGS="%{optflags}" %{__python2} setup.py %{?py_setup_args} build --executable="%{__python2} -s"}} -%{!?py2_install: %global py2_install %{expand: CFLAGS="%{optflags}" %{__python2} setup.py %{?py_setup_args} install -O1 --skip-build --root %{buildroot}}} - Name: python-productmd Version: 1.4 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Library providing parsers for metadata related to OS installation Group: Development/Tools @@ -38,9 +28,9 @@ BuildRequires: python-setuptools BuildRequires: python-six %if 0%{?with_python3} -BuildRequires: python3-devel -BuildRequires: python3-setuptools -BuildRequires: python3-six +BuildRequires: python%{python3_pkgversion}-devel +BuildRequires: python%{python3_pkgversion}-setuptools +BuildRequires: python%{python3_pkgversion}-six %endif BuildArch: noarch @@ -50,12 +40,12 @@ Python library providing parsers for metadata related to composes and installation media. %if 0%{?with_python3} -%package -n python3-productmd +%package -n python%{python3_pkgversion}-productmd Summary: Library providing parsers for metadata related to OS installation Group: Development/Tools -Requires: python3-six +Requires: python%{python3_pkgversion}-six -%description -n python3-productmd +%description -n python%{python3_pkgversion}-productmd Python library providing parsers for metadata related to composes and installation media. %endif @@ -95,7 +85,7 @@ and installation media. %if 0%{?with_python3} -%files -n python3-productmd +%files -n python%{python3_pkgversion}-productmd %license LICENSE %doc AUTHORS %{python3_sitelib}/productmd/ @@ -103,6 +93,9 @@ and installation media. %endif %changelog +* Fri Feb 10 2017 Adam Williamson - 1.4-2 +- Enable Python 3 build for EL 6+ + * Tue Jan 10 2017 Lubomír Sedlář 1.4-1 - Fix loading variants from legacy composeinfo. (dmach@redhat.com) - Fix sorting composes (lsedlar@redhat.com)