adamwill pushed to python-cached_property (f20). "fix various issues for older releases (..more)"

notifications at fedoraproject.org notifications at fedoraproject.org
Thu Mar 26 00:40:51 UTC 2015


>From 0b5c2ebe49da0755a6514557f2ccc236b85cca80 Mon Sep 17 00:00:00 2001
From: Adam Williamson <awilliam at redhat.com>
Date: Wed, 25 Mar 2015 16:35:05 -0700
Subject: fix various issues for older releases

Python3 build only for Fedora (no python3 in RHEL6 or 7).
Make sure things work if %license isn't available. Only run
checks on F22+ (tox is too old on everything else).

diff --git a/python-cached_property.spec b/python-cached_property.spec
index c6928e0..cbc6c5b 100644
--- a/python-cached_property.spec
+++ b/python-cached_property.spec
@@ -1,5 +1,9 @@
-%if 0%{?rhel} && 0%{?rhel} <= 6
-%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
+# RHEL 6 compatibility.
+%if 0%{?fedora} > 12
+%global with_python3 1
+%else
+%{!?__python2: %global __python2 /usr/bin/python2}
+%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")}
 %endif
 
 %global projectname cached-property
@@ -9,61 +13,92 @@
 
 Name:           python-%{modulename}
 Version:        1.0.0 
-Release:        2%{?dist}
+Release:        3%{?dist}
 Summary:        A cached-property for decorating methods in Python classes
 License:        BSD
 URL:            https://github.com/pydanny/%{projectname}
 Source0:        https://github.com/pydanny/%{projectname}/archive/%{commit}/%{projectname}-%{commit}.tar.gz
 
 BuildArch:      noarch
+Provides:       python2-%{modulename}
 BuildRequires:  python2-devel
 BuildRequires:  python-tox
 BuildRequires:  python-freezegun
+
+%if 0%{?with_python3}
 BuildRequires:  python3-devel
 BuildRequires:  python3-freezegun
+%endif # with_python3
 
 %description
 cached_property allows properties in Python classes to be cached until the cache
 is invalidated or expired.
 
+%if 0%{?with_python3}
 %package -n python3-%{projectname}
 Summary:        A cached-property for decorating methods in Python classes.
 
 %description -n python3-%{projectname}
 cached_property allows properties in Python classes to be cached until the cache
 is invalidated or expired.
+%endif # with_python3
 
 %prep
 %setup -q -n %{projectname}-%{commit}
+
+%if 0%{?with_python3}
+rm -rf %{py3dir}
 cp -a . %{py3dir}
+%endif # with_python3
 
 %build
 %{__python2} setup.py build
+
+%if 0%{?with_python3}
 pushd %{py3dir}
 %{__python3} setup.py build
 popd
+%endif # with_python3
 
 %install
 %{__python2} setup.py install -O1 --skip-build --root %{buildroot}
+
+%if 0%{?with_python3}
 pushd %{py3dir}
 %{__python3} setup.py install -O1 --skip-build --root %{buildroot}
 popd
+%endif # with_python3
 
 %check
+# --skip-missing-interpreters only exists in tox >= 1.7.2.
+# --sitepackages only exists in tox >= 1.7.0.
+# Fedora 20 and 21 have 1.7.1, RHEL 6 and 7 have 1.4.2.
+# I'm gonna go ahead and guess RHEL 8 will have something new enough...
+%if 0%{?fedora} > 21 || 0%{?rhel} > 7
 tox --sitepackages --skip-missing-interpreters
+%endif
 
 %files
+%{!?_licensedir:%global license %%doc}
 %doc AUTHORS.rst HISTORY.rst CONTRIBUTING.rst README.rst
 %license LICENSE
 %{python2_sitelib}/%{modulename}*
 
+%if 0%{?with_python3}
 %files -n python3-%{projectname}
 %doc AUTHORS.rst HISTORY.rst CONTRIBUTING.rst README.rst
 %license LICENSE
 %{python3_sitelib}/%{modulename}*
 %{python3_sitelib}/__pycache__/%{modulename}*
+%endif # with_python3
 
 %changelog
+* Wed Mar 25 2015 Adam Williamson <awilliam at redhat.com> - 1.0.0-3
+- python3 build only for Fedora (no python3 in RHEL6 or 7)
+- provide python2-cached_property
+- guard against %license not being available
+- only run tests on F>=22 (tox is too old on everything else)
+
 * Fri Mar 13 2015 Pete Travis <me at petetravis.com> - 1.0.0-2
 - Use the module name for the package name.
 
-- 
cgit v0.10.2


	http://pkgs.fedoraproject.org/cgit/python-cached_property.git/commit/?h=f20&id=0b5c2ebe49da0755a6514557f2ccc236b85cca80


More information about the scm-commits mailing list