[python-simplegeneric] add python3 subpackage (#785056)
tomspur
tomspur at fedoraproject.org
Fri Jan 27 18:20:30 UTC 2012
commit acdb70467f2bb386657f6a95de6e14b28ed686a7
Author: Thomas Spura <thomas.spura at gmail.com>
Date: Fri Jan 27 19:20:26 2012 +0100
add python3 subpackage (#785056)
python-simplegeneric.spec | 77 ++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 73 insertions(+), 4 deletions(-)
---
diff --git a/python-simplegeneric.spec b/python-simplegeneric.spec
index 4349443..ec1278b 100644
--- a/python-simplegeneric.spec
+++ b/python-simplegeneric.spec
@@ -1,10 +1,14 @@
-%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
+%if 0%{?fedora} > 15 || 0%{?rhel} > 6
+%global with_python3 1
+%else
+%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")}
+%endif
%global modname simplegeneric
Name: python-simplegeneric
Version: 0.8
-Release: 2%{?dist}
+Release: 3%{?dist}
Summary: Simple generic functions (similar to Python's own len(), pickle.dump(), etc.)
Group: Development/Languages
@@ -16,6 +20,10 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
BuildRequires: python-devel
BuildRequires: python-setuptools-devel
+%if 0%{?with_python3}
+BuildRequires: python3-devel
+BuildRequires: /usr/bin/2to3
+%endif
%description
The simplegeneric module lets you define simple single-dispatch generic
@@ -24,19 +32,66 @@ so on. However, instead of using specially-named methods, these generic
functions use simple lookup tables, akin to those used by e.g. pickle.dump()
and other generic functions found in the Python standard library.
+
+%if 0%{?with_python3}
+%package -n python3-%{modname}
+Summary: Simple generic functions (similar to Python's own len(), pickle.dump(), etc.)
+
+Group: Development/Languages
+License: Python or ZPLv2.1
+
+%description -n python3-%{modname}
+The simplegeneric module lets you define simple single-dispatch generic
+functions, akin to Python's built-in generic functions like len(), iter() and
+so on. However, instead of using specially-named methods, these generic
+functions use simple lookup tables, akin to those used by e.g. pickle.dump()
+and other generic functions found in the Python standard library.
+%endif # with_python3
+
+
%prep
%setup -q -n %{modname}-%{version}
+%if 0%{?with_python3}
+rm -rf %{py3dir}
+cp -a . %{py3dir}
+pushd %{py3dir}
+ 2to3 --write --nobackups .
+ sed -i "s/file(/open(/g" setup.py
+popd
+find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
+%endif # with_python3
+
+find -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python}|'
+
+
%build
%{__python} setup.py build
+%if 0%{?with_python3}
+pushd %{py3dir}
+%{__python3} setup.py build
+popd
+%endif # with_python3
+
%install
rm -rf %{buildroot}
-%{__python} setup.py install --skip-build --root %{buildroot}
+%if 0%{?with_python3}
+pushd %{py3dir}
+%{__python3} setup.py install --skip-build --root %{buildroot}
+popd
+%endif # with_python3
+%{__python} setup.py install --skip-build --root %{buildroot}
%check
+%if 0%{?with_python3}
+pushd %{py3dir}
+PYTHONPATH=$(pwd) %{__python3} setup.py test
+popd
+%endif # with_python3
+
PYTHONPATH=$(pwd) %{__python} setup.py test
%clean
@@ -45,9 +100,23 @@ rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
%doc README.txt
-%{python_sitelib}/*
+%{python_sitelib}/simplegeneric.py*
+%{python_sitelib}/simplegeneric-%{version}-py?.?.egg-info
+
+%if 0%{?with_python3}
+%files -n python3-%{modname}
+%defattr(-,root,root,-)
+%doc README.txt
+%{python3_sitelib}/__pycache__/simplegeneric.cpython*
+%{python3_sitelib}/simplegeneric.py*
+%{python3_sitelib}/simplegeneric-%{version}-py?.?.egg-info
+%endif # with_python3
%changelog
+* Fri Jan 27 2012 Thomas Spura <tomspur at fedoraproject.org> - 0.8-3
+- be more explicit in files section
+- add python3 subpackage (#785056)
+
* Sat Jan 14 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.8-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
More information about the scm-commits
mailing list