%global pypi_name cssmin Name: python-cssmin Version: 0.1.4 Release: 3%{?dist} Summary: A Python port of the YUI CSS compression algorithm Group: Development/Libraries License: BSD URL: http://github.com/zacharyvoase/cssmin Source0: https://pypi.python.org/packages/source/c/%{pypi_name}/%{pypi_name}-%{version}.tar.gz # Upstream patch https://github.com/zacharyvoase/cssmin/commit/61d167466 Patch0: python-cssmin-fixed-import-for-python3.patch BuildArch: noarch BuildRequires: python2-devel python3-devel python-setuptools %description %{summary} %package -n python3-%{pypi_name} Summary: %{summary} %description -n python3-%{pypi_name} %{summary} This is the version for Python 3.x. %prep %setup -q -n %{pypi_name}-%{version} %patch0 -p1 # remove shebang from non-executable sed '1{\@^#!/usr/bin/env python@d}' src/cssmin.py > src/cssmin.py.new && touch -r src/cssmin.py src/cssmin.py.new && mv src/cssmin.py.new src/cssmin.py %build %{__python} setup.py build %install # install py version first, so that binary gets overwritten by py2 version %{__python3} setup.py install --skip-build -O1 --root %{buildroot} %{__python} setup.py install --skip-build -O1 --root %{buildroot} %check cd src && \ for p in %{__python} %{__python3}; do \ "$p" -c 'import cssmin; cssmin.cssmin("""\ #href { \ font-size: 3; \ }""")'; \ done %files %doc PKG-INFO %{python_sitelib}/cssmin.py* %{python_sitelib}/*.egg-info %{_bindir}/* %files -n python3-cssmin %{python3_sitelib}/cssmin.py %{python3_sitelib}/__pycache__/cssmin.*.py* %{python3_sitelib}/*.egg-info %changelog * Mon Oct 07 2013 Zbigniew Jędrzejewski-Szmek - 0.1.4-3 - Add python3 subpackage and modify %%check section * Mon Oct 07 2013 Martin Krizek - 0.1.4-2 - Add python3-devel as dep - Add check section * Tue Oct 01 2013 Martin Krizek - 0.1.4-1 - Initial packaging