diff --git a/python-productmd.spec b/python-productmd.spec index 41ee5b6..fc8663d 100644 --- a/python-productmd.spec +++ b/python-productmd.spec @@ -1,14 +1,18 @@ -%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 +# 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())")} -%global with_python3 0 -%endif +%{!?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}}} # compatibility with older releases %{!?__python2: %global __python2 /usr/bin/python2} @@ -19,7 +23,7 @@ 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 +42,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 +54,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 +99,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 +107,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)