%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-cssselect Version: 0.8 Release: 1%{?dist} Group: Development/Libraries Summary: Parses CSS3 Selectors and translates them to XPath 1.0 License: BSD URL: http://packages.python.org/cssselect/ Source0: http://pypi.python.org/packages/source/c/cssselect/cssselect-%{version}.tar.gz BuildArch: noarch BuildRequires: python2-devel python-setuptools python-lxml %if 0%{?with_python3} BuildRequires: python3-devel python3-setuptools python3-lxml %endif # if with_python3 %description Cssselect parses CSS3 Selectors and translates them to XPath 1.0 expressions. Such expressions can be used in lxml or another XPath engine to find the matching elements in an XML or HTML document. %if 0%{?with_python3} %package -n python3-cssselect Group: Development/Libraries Summary: Parses CSS3 Selectors and translates them to XPath 1.0 %description -n python3-cssselect Cssselect parses CSS3 Selectors and translates them to XPath 1.0 expressions. Such expressions can be used in lxml or another XPath engine to find the matching elements in an XML or HTML document. %endif # if with_python3 %prep %setup -q -n cssselect-%{version} %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 %check PYTHONPATH=$(pwd) python cssselect/tests.py %if 0%{?with_python3} pushd %{py3dir} PYTHONPATH=${py3dir} %{__python3} cssselect/tests.py popd %endif # with_python3 %install python setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT chmod 755 $RPM_BUILD_ROOT/%{python_sitelib}/cssselect/tests.py %if 0%{?with_python3} pushd %{py3dir} %{__python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT chmod 755 $RPM_BUILD_ROOT/%{python3_sitelib}/cssselect/tests.py popd %endif # with_python3 %files %doc AUTHORS docs README.rst CHANGES LICENSE PKG-INFO %{python_sitelib}/cssselect* %if 0%{?with_python3} %files -n python3-cssselect %doc AUTHORS docs README.rst CHANGES LICENSE PKG-INFO %{python3_sitelib}/cssselect* %endif # with_python3 %changelog * Thu Jul 25 2013 Eric Smith 0.8-1 - Update to latest upstream. - Added Python 3 support. - Added EL6 support (uses Python 2.6 rather than 2.7). * Thu Feb 14 2013 Fedora Release Engineering - 0.7.1-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild * Fri Nov 09 2012 Kevin Fenzi 0.7.1-3 - Add tests. * Fri Nov 09 2012 Kevin Fenzi 0.7.1-2 - Fixes from review. * Fri Nov 09 2012 Kevin Fenzi 0.7.1-1 - Initial version for review