[python-catkin-sphinx/f20] Add python3 package

Scott K Logan cottsay at fedoraproject.org
Sun Dec 14 08:24:29 UTC 2014


commit 96342c9d9f8195410325a996932e9e6de95dde7b
Author: Scott K Logan <logans at cottsay.net>
Date:   Sat Dec 13 23:40:24 2014 -0800

    Add python3 package

 python-catkin-sphinx.spec |   73 +++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 64 insertions(+), 9 deletions(-)
---
diff --git a/python-catkin-sphinx.spec b/python-catkin-sphinx.spec
index e60ca55..48cbc09 100644
--- a/python-catkin-sphinx.spec
+++ b/python-catkin-sphinx.spec
@@ -2,42 +2,97 @@
 %global shortcommit %(c=%{commit}; echo ${c:0:7})
 %global realname catkin-sphinx
 
-Name:           python-catkin-sphinx
+%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
+
+Name:           python-%{realname}
 Version:        0.2.1
-Release:        3.20130602git%{shortcommit}%{?dist}
+Release:        4.20130602git%{shortcommit}%{?dist}
 Summary:        Sphinx plugins for Catkin projects
 
 License:        BSD
-URL:            https://github.com/ros/catkin-sphinx
+URL:            https://github.com/ros/%{realname}
 Source0:        https://github.com/ros/%{realname}/archive/%{commit}/%{realname}-%{version}-%{shortcommit}.tar.gz
 
-BuildRequires:  python2-devel
-Requires:       python-sphinx
 BuildArch:      noarch
 
+Requires:       python-sphinx
+BuildRequires:  python2-devel
+
+
+%if 0%{?with_python3}
+%package -n python3-%{realname}
+Summary:        Sphinx plugins for Catkin projects
+
+BuildRequires:  python3-devel
+Requires:       python3-sphinx
+%endif
+
 
 %description
 Sphinx plugins for Catkin projects.
 
 
+%if 0%{?with_python3}
+%description -n python3-%{realname}
+Sphinx plugins for Catkin projects.
+%endif
+
+
 %prep
 %setup -qn %{realname}-%{commit}
 
+%if 0%{?with_python3}
+rm -rf %{py3dir}
+cp -a . %{py3dir}
+find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
+%endif
+
+find -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python2}|'
+
 
 %build
-%{__python} setup.py build
+%{__python2} setup.py build
+
+%if 0%{?with_python3}
+pushd %{py3dir}
+%{__python3} setup.py build
+popd
+%endif
 
 
 %install
-%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
+%{__python2} setup.py install --skip-build --root %{buildroot}
+
+%if 0%{?with_python3}
+pushd %{py3dir}
+%{__python3} setup.py install --skip-build --root %{buildroot}
+popd
+%endif
 
  
 %files
 %doc README.md
-%{python_sitelib}/catkin_sphinx
-%{python_sitelib}/catkin_sphinx-%{version}-py?.?.egg-info
+%{python2_sitelib}/catkin_sphinx
+%{python2_sitelib}/catkin_sphinx-%{version}-py?.?.egg-info
+
+
+%if 0%{?with_python3}
+%files -n python3-%{realname}
+%doc README.md
+%{python3_sitelib}/catkin_sphinx
+%{python3_sitelib}/catkin_sphinx-%{version}-py?.?.egg-info
+%endif
+
 
 %changelog
+* Sat Dec 13 2014 Scott K Logan <logans at cottsay.net> - 0.2.1-4.20130602gitc00d68b
+- Add python3 package
+
 * Sun Aug 04 2013 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.2.1-3.20130602gitc00d68b
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
 


More information about the scm-commits mailing list