[python-manuel/el6] Conditionalize python3 for epel.

Ralph Bean ralph at fedoraproject.org
Fri Jan 24 18:19:55 UTC 2014


commit 195898baf8aed1098182e139e8985a4b31616348
Author: Ralph Bean <rbean at redhat.com>
Date:   Fri Jan 24 13:20:10 2014 -0500

    Conditionalize python3 for epel.

 python-manuel.spec |   71 +++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 57 insertions(+), 14 deletions(-)
---
diff --git a/python-manuel.spec b/python-manuel.spec
index 5116e98..fb1a99b 100644
--- a/python-manuel.spec
+++ b/python-manuel.spec
@@ -1,6 +1,16 @@
+%if 0%{?fedora}
+%global with_python3 1
+%endif
+
+%if 0%{?rhel} && 0%{?rhel} <= 6
+%{!?__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))")}
+%endif
+
 Name:           python-manuel
 Version:        1.7.2
-Release:        3%{?dist}
+Release:        4%{?dist}
 Summary:        Build tested documentation
 
 Group:          Development/Libraries
@@ -12,11 +22,18 @@ Source0:        https://pypi.python.org/packages/source/m/manuel/manuel-%{versio
 Source1:        conf.py
 
 BuildArch:      noarch
-BuildRequires:  python-setuptools python3-setuptools
-BuildRequires:  python-sphinx python3-sphinx
-BuildRequires:  python-six python3-six
+BuildRequires:  python-setuptools
+BuildRequires:  python-sphinx
+BuildRequires:  python-six
 BuildRequires:  python-zope-testing
-BuildRequires:  python2-devel python3-devel
+BuildRequires:  python2-devel
+
+%if 0%{?with_python3}
+BuildRequires:  python3-setuptools
+BuildRequires:  python3-sphinx
+BuildRequires:  python3-six
+BuildRequires:  python3-devel
+%endif
 
 Requires:       python-six
 
@@ -25,6 +42,8 @@ Manuel lets you mix and match traditional doctests with custom test
 syntax.  Several plug-ins are included that provide new test syntax.
 You can also create your own plug-ins.
 
+
+%if 0%{?with_python3}
 %package -n python3-manuel
 Summary:        Build tested documentation
 Group:          Development/Libraries
@@ -34,6 +53,7 @@ Requires:       python3-six
 Manuel lets you mix and match traditional doctests with custom test
 syntax.  Several plug-ins are included that provide new test syntax.
 You can also create your own plug-ins.
+%endif
 
 %prep
 %setup -q -n manuel-%{version}
@@ -41,6 +61,11 @@ rm -fr src/manuel.egg-info
 mkdir sphinx
 cp -p %{SOURCE1} sphinx
 
+%if 0%{?with_python3}
+rm -rf %{py3dir}
+cp -a . %{py3dir}
+%endif
+
 %build
 %{__python2} setup.py build
 
@@ -49,34 +74,52 @@ sphinx-build -c sphinx src/manuel docs
 rm -fr docs/.buildinfo docs/.doctrees
 
 # Build for python3
-mv build build2
-cp -a src/manuel.egg-info src/manuel.egg-info2
+%if 0%{?with_python3}
+pushd %{py3dir}
 %{__python3} setup.py build
+popd
+%endif
 
 %install
+%if 0%{?with_python3}
+pushd %{py3dir}
 %{__python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
-mv build build3
-mv build2 build
-mv src/manuel.egg-info src/manuel.egg-info3
-mv src/manuel.egg-info2 src/manuel.egg-info
+rm -f $RPM_BUILD_ROOT%{python3_sitelib}/manuel/*.txt
+popd
+%endif
+
 %{__python2} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
 
 # Remove text files that are included as HTML in docs
 rm -f $RPM_BUILD_ROOT%{python2_sitelib}/manuel/*.txt
-rm -f $RPM_BUILD_ROOT%{python3_sitelib}/manuel/*.txt
 
 %check
 %{__python2} setup.py test
 
+%if 0%{?with_python3}
+pushd %{py3dir}
+%{__python3} setup.py test
+popd
+%endif
+
 %files
 %doc CHANGES.txt COPYRIGHT.txt LICENSE.txt README.rst docs
-%{python2_sitelib}/*
+%{python2_sitelib}/manuel/
+%{python2_sitelib}/manuel-%{version}-*
 
+%if 0%{?with_python3}
 %files -n python3-manuel
 %doc CHANGES.txt COPYRIGHT.txt LICENSE.txt README.rst docs
-%{python3_sitelib}/*
+%{python3_sitelib}/manuel/
+%{python3_sitelib}/manuel-%{version}-*
+%endif
 
 %changelog
+* Fri Jan 24 2014 Ralph Bean <rbean at redhat.com> - 1.7.2-4
+- Conditionalized python3 for epel builds.
+- Defined python2 macros for el6.
+- Added python3 tests to the check section.
+
 * Thu Oct  3 2013 Jerry James <loganjerry at gmail.com> - 1.7.2-3
 - Update project and source URLs
 


More information about the scm-commits mailing list