[python-docker-py/f21] Added Python 3 support

Tomas Radej tradej at fedoraproject.org
Tue Dec 2 16:17:33 UTC 2014


commit 6d7b8464a208592d40929951189ffffb05e4ed9e
Author: Tomas Radej <tradej at redhat.com>
Date:   Mon Dec 1 16:55:13 2014 +0100

    Added Python 3 support

 python-docker-py.spec |   59 ++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 58 insertions(+), 1 deletions(-)
---
diff --git a/python-docker-py.spec b/python-docker-py.spec
index f9ccee5..38589d2 100644
--- a/python-docker-py.spec
+++ b/python-docker-py.spec
@@ -1,9 +1,13 @@
+%if 0%{?fedora}
+%global         with_python3    1
+%endif #fedora
+
 # disable debug package cause archful
 %global         debug_package   %{nil}
 
 Name:           python-docker-py
 Version:        0.6.0
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        An API client for docker written in Python
 License:        ASL 2.0
 URL:            http://www.docker.com
@@ -16,6 +20,14 @@ BuildRequires:  python-setuptools
 BuildRequires:  python-tools
 BuildRequires:  python-websocket-client >= 0.11.0
 
+%if 0%{?with_python3}
+BuildRequires:  python3-devel
+BuildRequires:  python3-tools
+BuildRequires:  python3-setuptools
+BuildRequires:  python3-requests
+BuildRequires:  python3-websocket-client >= 0.11.0
+%endif # with_python3
+
 # Resolves: rhbz#1132604 (epel7 only)
 %if 0%{?fedora} >= 21 || 0%{?rhel} >= 7
 BuildRequires:  docker
@@ -39,15 +51,48 @@ Requires:       python-six >= 1.3.0
 %description
 %{summary}
 
+%if 0%{?with_python3}
+%package -n python3-docker-py
+Requires:       python3-websocket-client >= 0.11.0
+Requires:       python3-requests
+Requires:       python3-six >= 1.3.0
+Summary:        An API client for docker written in Python 3
+
+%description -n python3-docker-py
+A Python 3 interface to Docker
+%endif # with_python3
+
 %prep
 %setup -q -n docker-py-%{version}
 
+%if 0%{?with_python3}
+rm -rf %{py3dir}
+cp -a . %{py3dir}
+pushd %{py3dir}
+find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
+popd
+%endif # with_python3
+
+
 %build
 %{__python} setup.py build
 
+%if 0%{?with_python3}
+pushd %{py3dir}
+%{__python3} setup.py build
+popd
+%endif # with_python3
+
+
 %install
 %{__python} setup.py install --root %{buildroot}
 
+%if 0%{?with_python3}
+pushd %{py3dir}
+%{__python3} setup.py install --root %{buildroot}
+popd
+%endif # with_python3
+
 %files
 %doc LICENSE README.md
 %dir %{python_sitelib}/docker
@@ -55,7 +100,19 @@ Requires:       python-six >= 1.3.0
 %{python_sitelib}/docker/*
 %{python_sitelib}/docker_py-%{version}-py2*.egg-info/*
 
+%if 0%{?with_python3}
+%files -n python3-docker-py
+%doc LICENSE README.md
+%dir %{python3_sitelib}/docker
+%dir %{python3_sitelib}/docker_py-%{version}-py3*.egg-info
+%{python3_sitelib}/docker/*
+%{python3_sitelib}/docker_py-%{version}-py3*.egg-info/*
+%endif # with_python3
+
 %changelog
+* Mon Dec 01 2014 Tomas Radej <tradej at redhat.com> - 0.6.0-2
+- Added Python 3 subpackage
+
 * Fri Nov 21 2014 Lokesh Mandvekar <lsm5 at fedoraproject.org> - 0.6.0-1
 - Resolves: rhbz#1160293 - update to 0.6.0
 


More information about the scm-commits mailing list