[python-tinycss] Add Python 3 support.
Eric Smith
brouhaha at fedoraproject.org
Tue Jul 23 21:01:56 UTC 2013
commit cb147c87d449997590e438d0200716033d54be7d
Author: Eric Smith <brouhaha at fedoraproject.org>
Date: Tue Jul 23 15:01:22 2013 -0600
Add Python 3 support.
python-tinycss.spec | 59 ++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 54 insertions(+), 5 deletions(-)
---
diff --git a/python-tinycss.spec b/python-tinycss.spec
index f2b37f6..3c2f40b 100644
--- a/python-tinycss.spec
+++ b/python-tinycss.spec
@@ -1,17 +1,27 @@
+%if 0%{?fedora} > 12 || 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
+
Name: python-tinycss
-Version: 0.3
-Release: 1%{?dist}
-Group: Applications/File
Summary: CSS parser for Python
+Version: 0.3
+Release: 2%{?dist}
+Group: System Environment/Libraries
License: BSD
URL: http://pythonhosted.org/tinycss/
Source0: https://github.com/SimonSapin/tinycss/archive/v%{version}.tar.gz
-BuildRequires: python2-devel python-setuptools Cython dos2unix
+BuildRequires: dos2unix
+BuildRequires: python2-devel python-setuptools Cython
+%if 0%{?with_python3}
+BuildRequires: python3-devel python3-setuptools python3-Cython
+%endif # if with_python3
# Do not check .so files in the python_sitelib directory
# or any files in the application's directory for provides
-%global __provides_exclude_from ^(%{python_sitearch}/.*\\.so|%{_datadir}/myapp/.*)$
+%global __provides_exclude_from ^(%{python_sitearch}|%{python3_sitearch})/.*\\.so$
%description
tinycss is a complete yet simple CSS parser for Python. It supports
@@ -19,20 +29,59 @@ the full syntax and error handling for CSS 2.1 as well as some CSS 3
modules. It is designed to be easy to extend for new CSS modules and
syntax, and integrates well with cssselect for Selectors 3 support.
+%if 0%{?with_python3}
+%package -n python3-tinycss
+Summary: CSS parser for Python
+Group: System Environment/Libraries
+
+%description -n python3-tinycss
+tinycss is a complete yet simple CSS parser for Python. It supports
+the full syntax and error handling for CSS 2.1 as well as some CSS 3
+modules. It is designed to be easy to extend for new CSS modules and
+syntax, and integrates well with cssselect for Selectors 3 support.
+%endif # if with_python3
+
%prep
%setup -q -n tinycss-%{version}
dos2unix LICENSE
+%if 0%{?with_python3}
+rm -rf %{py3dir}
+cp -a . %{py3dir}
+find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!/usr/bin/python|#!%{__python3}|'
+%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 --skip-build --prefix=%{_prefix} --root %{buildroot}
+%if 0%{?with_python3}
+pushd %{py3dir}
+%{__python3} setup.py install --skip-build --prefix=%{_prefix} --root %{buildroot}
+popd
+%endif # with_python3
+
%files
%doc LICENSE README.rst
%{python_sitearch}/*
+%if 0%{?with_python3}
+%files -n python3-tinycss
+%doc LICENSE README.rst
+%{python3_sitearch}/*
+%endif # with_python3
+
%changelog
+* Tue Jul 23 2013 Eric Smith <brouhaha at fedoraproject.org> 0.3-2
+- Added Python 3 support.
+
* Sat Jul 20 2013 Eric Smith <brouhaha at fedoraproject.org> 0.3-1
- initial version
More information about the scm-commits
mailing list