[python-vcstools] Added python 3 support

rmattes rmattes at fedoraproject.org
Sun Feb 9 18:16:09 UTC 2014


commit d840feef11c3e6c5215d6cdc46ee24f451661dbb
Author: Rich Mattes <richmattes at gmail.com>
Date:   Sun Feb 9 13:16:37 2014 -0500

    Added python 3 support

 python-vcstools.spec |   59 ++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 53 insertions(+), 6 deletions(-)
---
diff --git a/python-vcstools.spec b/python-vcstools.spec
index fe4bd4c..1eead82 100644
--- a/python-vcstools.spec
+++ b/python-vcstools.spec
@@ -1,10 +1,11 @@
 %global commit 7effcc53209eb7e9882219aeec7b30519ba870d5
 %global shortcommit %(c=%{commit}; echo ${c:0:7})
 %global realname vcstools
+%global with_python3 1
 
 Name:           python-%{realname}
 Version:        0.1.32
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        Version Control System tools for Python
 
 License:        BSD
@@ -17,6 +18,12 @@ BuildRequires:  python-devel
 BuildRequires:  python-sphinx
 BuildRequires:  PyYAML
 
+%if 0%{?with_python3}
+BuildRequires:  python3-dateutil
+BuildRequires:  python3-devel
+BuildRequires:  python3-PyYAML
+%endif
+
 Requires:       python-dateutil
 Requires:       PyYAML
 
@@ -27,37 +34,77 @@ for seamless interacting with Git, Mercurial (Hg), Bzr and SVN. The focus
 of the API is manipulating on-disk checkouts of source-controlled trees. 
 Its main use is to support the rosinstall tool.
 
+%if 0%{?with_python3}
+%package -n python3-%{realname}
+Summary: Version Control System tools for Python
+Requires:       python3-dateutil
+Requires:       python3-PyYAML
+
+%description -n python3-%{realname}
+The vcstools module provides a Python API for interacting with different
+version control systems (VCS/SCMs). The VcsClient class provides an API
+for seamless interacting with Git, Mercurial (Hg), Bzr and SVN. The focus
+of the API is manipulating on-disk checkouts of source-controlled trees.
+Its main use is to support the rosinstall tool.
+%endif
+
 %prep
 %setup -qn %{realname}-%{commit}
 sed -i 's/haiku/default/' doc/conf.py
 sed -i 's/:special-members://' doc/vcstools.rst
 
+%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|#!%{__python}|'
+
 %build
+CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build
+%if 0%{?with_python3}
+pushd %{py3dir}
+CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build
+popd
+%endif # with_python3
+
 pushd doc
 make html
-%if ! 0%{?rhel}
 make man
-%endif
 popd
 
 %install
+%if 0%{?with_python3}
+pushd %{py3dir}
+%{__python3} setup.py install --skip-build --root $RPM_BUILD_ROOT
+rm -rf %{buildroot}%{python3_sitelib}/setuptools/tests
+popd
+%endif # with_python3
+
 %{__python} setup.py install --root $RPM_BUILD_ROOT
-%if ! 0%{?rhel}
 mkdir -p $RPM_BUILD_ROOT%{_mandir}/man1
 chmod -x doc/_build/man/vcstools.1
 install -p -m 0644 doc/_build/man/vcstools.1 $RPM_BUILD_ROOT%{_mandir}/man1/
-%endif
 rm -rf doc/_build/html/.buildinfo
 
 %files
 %doc doc/_build/html LICENSE 
 %{python_sitelib}/%{realname}
 %{python_sitelib}/%{realname}-*.egg-info
-%if ! 0%{?rhel}
+%{_mandir}/man1/*.gz
+
+%if 0%{?with_python3}
+%files -n python3-%{realname}
+%doc doc/_build/html LICENSE
+%{python3_sitelib}/%{realname}
+%{python3_sitelib}/%{realname}-*.egg-info
 %{_mandir}/man1/*.gz
 %endif
 
 %changelog
+* Sun Feb 09 2014 Rich Mattes <richmattes at gmail.com> - 0.1.32-2
+- Added python 3 support
+
 * Sat Feb 08 2014 Rich Mattes <richmattes at gmail.com> - 0.1.32-1
 - Update to release 0.1.32
 


More information about the scm-commits mailing list