[python-straight-plugin] Fix build since el6 has the strange idea not to have python3 and fix comment on tarball generation

Pierre-YvesChibon pingou at fedoraproject.org
Fri Nov 11 15:35:36 UTC 2011


commit 637b020cf8f40d34d640266e8d29425f533c2ce2
Author: Pierre-Yves Chibon <pingou at pingoured.fr>
Date:   Fri Nov 11 16:35:16 2011 +0100

    Fix build since el6 has the strange idea not to have python3 and fix comment on tarball generation

 python-straight-plugin.spec |   38 +++++++++++++++++++++++++++++++-------
 1 files changed, 31 insertions(+), 7 deletions(-)
---
diff --git a/python-straight-plugin.spec b/python-straight-plugin.spec
index 53c94ca..e5b360e 100644
--- a/python-straight-plugin.spec
+++ b/python-straight-plugin.spec
@@ -1,20 +1,32 @@
-%global githash 57ef11c
+%if 0%{?fedora} > 12 || 0%{?rhel} > 6
+%global with_python3 1
+%else
+%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")}
+%endif
+
+%global        snapdate   20111110
+%global        snaphash   57ef11c
+%global        snapver    %{snapdate}.git%{snaphash}
 
 Name:           python-straight-plugin
 Version:        1.1.1
-Release:        0.3.20111110git%{githash}%{?dist}
+Release:        0.4.%{snapver}%{?dist}
 Summary:        Python plugin loader
 
 License:        BSD
 URL:            https://github.com/ironfroggy/straight.plugin/
 
-# url: https://github.com/ironfroggy/straight.plugin/tarball/57ef11c
+# Upstream doesn't publish release tarballs yet, so we make one:
+#  $ git clone git://github.com/ironfroggy/straight.plugin.git && cd straight.plugin
+#  $ git archive --format=tar --prefix=straight.plugin-1.1.1/ 57ef11c | xz -z > straight.plugin-1.1.1-20111110.git57ef11c.tar.xz
 Source0:        ironfroggy-straight.plugin-%{githash}.tar.gz
 
 BuildArch:      noarch
 BuildRequires:  python2-devel
+%if 0%{?with_python3}
 BuildRequires:  python3-devel
 BuildRequires:  python-tools
+%endif
 
 %description
 straight.plugin is a Python plugin loader inspired by twisted.plugin with two
@@ -29,6 +41,7 @@ themselves are modules in a namespace package where the namespace identifies
 the plugins in it for some particular purpose or intent.
 
 
+%if 0%{?with_python3}
 %package -n     python3-straight-plugin
 Summary:        Python plugin loader
 
@@ -43,24 +56,26 @@ The system is used to allow multiple Python packages to provide plugins within
 a namespace package, where other packages will locate and utilize. The plugins
 themselves are modules in a namespace package where the namespace identifies
 the plugins in it for some particular purpose or intent.
-
+%endif
 
 %prep
 %setup -q -c -n ironfroggy-straight.plugin-%{githash}
 
+%if 0%{?with_python3}
 cp -r ironfroggy-straight.plugin-%{githash} py3-ironfroggy-straight.plugin-%{githash}
-
 2to3 --write --nobackups py3-ironfroggy-straight.plugin-%{githash}
-
+%endif
 
 %build
 pushd ironfroggy-straight.plugin-%{githash}
 %{__python} setup.py build
 popd
 
+%if 0%{?with_python3}
 pushd py3-ironfroggy-straight.plugin-%{githash}
 %{__python3} setup.py build
 popd
+%endif
 
 %install
 rm -rf $RPM_BUILD_ROOT
@@ -68,31 +83,40 @@ pushd ironfroggy-straight.plugin-%{githash}
 %{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
 popd
 
+%if 0%{?with_python3}
 pushd py3-ironfroggy-straight.plugin-%{githash}
 %{__python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
 popd
+%endif
 
 %check
 pushd ironfroggy-straight.plugin-%{githash}
 %{__python} tests.py
 popd
 
+%if 0%{?with_python3}
 pushd py3-ironfroggy-straight.plugin-%{githash}
 %{__python3} tests.py
 popd
+%endif
 
 %files
 %doc ironfroggy-straight.plugin-%{githash}/LICENSE ironfroggy-straight.plugin-%{githash}/README
 # For noarch packages: sitelib
 %{python_sitelib}/*
 
+%if 0%{?with_python3}
 %files -n python3-straight-plugin
 %doc py3-ironfroggy-straight.plugin-%{githash}/LICENSE py3-ironfroggy-straight.plugin-%{githash}/README
 # For noarch packages: sitelib
 %{python3_sitelib}/*
-
+%endif
 
 %changelog
+* Fri Nov 11 2011 Pierre-Yves Chibon <pingou at pingoured.fr> - 1.1.1-0.4.20111110git57ef11c
+- EL6 has no python3 /me should get glasses...
+- Fix comment on how to generate the tarball properly (previous method didn't keep the timestamp)
+
 * Thu Nov 10 2011 Pierre-Yves Chibon <pingou at pingoured.fr> - 1.1.1-0.3.20111110git57ef11c
 - Fix the use of __python3 for the tests and the build
 - Change python-devel to python2-devel on the BR


More information about the scm-commits mailing list