[python-collada] Add Python 3 support.

Richard Shaw hobbes1069 at fedoraproject.org
Mon Sep 8 15:04:02 UTC 2014


commit 51c0941b6143e040704cb5d6a7218b773f74d613
Author: Richard M. Shaw <hobbes1069 at gmail.com>
Date:   Mon Sep 8 10:03:56 2014 -0500

    Add Python 3 support.

 python-collada.spec |   72 +++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 67 insertions(+), 5 deletions(-)
---
diff --git a/python-collada.spec b/python-collada.spec
index 689a306..7d18535 100644
--- a/python-collada.spec
+++ b/python-collada.spec
@@ -1,8 +1,9 @@
 %global realname pycollada
+%global with_python3 1
 
 Name:           python-collada
 Version:        0.4
-Release:        5%{?dist}
+Release:        6%{?dist}
 Summary:        A python module for creating, editing and loading COLLADA
 Group:          Development/Languages
 
@@ -15,6 +16,7 @@ Patch0:         python-collada-0.4-disable_unittest_downloads.patch
 
 BuildArch:      noarch
 
+# Python 2 
 BuildRequires:  python2-devel
 BuildRequires:  python-setuptools
 # unit test requirements
@@ -22,6 +24,14 @@ BuildRequires:  python-dateutil
 BuildRequires:  python-unittest2
 BuildRequires:  numpy
 
+%if 0%{?with_python3}
+# Python 3
+BuildRequires:  python3-devel
+BuildRequires:  python3-setuptools
+BuildRequires:  python3-dateutil
+BuildRequires:  python3-numpy
+%endif
+
 Requires:       python-dateutil
 Requires:       numpy
 
@@ -36,29 +46,81 @@ object. In addition, it supports creating a collada python object from scratch,
 as well as in-place editing.
 
 
+%if 0%{?with_python3}
+%package -n python3-collada
+Summary:        A python 3 module for creating, editing and loading COLLADA
+Requires:       python3-dateutil
+Requires:       python3-numpy
+
+%description -n python3-collada
+pycollada is a python 3 module for creating, editing and loading COLLADA, which
+is a COLLAborative Design Activity for establishing an interchange file format
+for interactive 3D applications.
+
+The library allows you to load a COLLADA file and interact with it as a python
+object. In addition, it supports creating a collada python object from scratch,
+as well as in-place editing.
+%endif
+
+
 %prep
 %setup -q -n %{realname}-%{version}
 %patch0 -p1 -z .no_downloads
 
+%if 0%{?with_python3}
+rm -rf %{py3dir}
+cp -a . %{py3dir}
+%endif # with_python3
+
 
 %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 %{buildroot}
+# Must do the python3 install first because the scripts in /usr/bin are
+# overwritten with every setup.py install (and we want the python2 version
+# to be the default for now).
+%if 0%{?with_python3}
+pushd %{py3dir}
+%{__python3} setup.py install -O1 --skip-build --root %{buildroot}
+popd
+%endif
+
+%{__python2} setup.py install -O1 --skip-build --root %{buildroot}
 
  
 %check
-%{__python} setup.py test
+%{__python2} setup.py test
+
+%if 0%{?with_python3}
+pushd %{py3dir}
+%{__python3} setup.py test
+popd
+%endif
 
 
 %files
 %doc AUTHORS.md CHANGELOG.rst COPYING README.markdown
-%{python_sitelib}/*
+%{python2_sitelib}/*
+
+%if 0%{?with_python3}
+%files -n python3-collada
+%doc AUTHORS.md CHANGELOG.rst COPYING README.markdown
+%{python3_sitelib}/*
+%endif
 
 
 %changelog
+* Mon Sep  8 2014 Richard Shaw <hobbes1069 at gmail.com> - 0.4-6
+- Add Python 3 support.
+
 * Sat Jun 07 2014 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.4-5
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
 


More information about the scm-commits mailing list