From Fedora Project Wiki
%global pypi_name click %global with_python3 1 %global with_python2 1 %{!?py2dir: %global py2dir %{_builddir}/python2-%{name}-%{version}-%{release}} Name: python-%{pypi_name} Version: 4.0 Release: 2%{?dist} Summary: A simple wrapper around optparse for powerful command line utilities License: BSD URL: http://github.com/mitsuhiko/click Source0: https://pypi.python.org/packages/source/c/%{pypi_name}/%{pypi_name}-%{version}.tar.gz BuildArch: noarch %if %{?with_python2} BuildRequires: python2-devel BuildRequires: python2-setuptools BuildRequires: python2-pytest %endif # if with_python2 %if %{?with_python3} BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pytest %endif # if with_python3 %description click is a Python package for creating beautiful command line interfaces in a composable way with as little amount of code as necessary. It's the "Command Line Interface Creation Kit". It's highly configurable but comes with good defaults out of the box. %if 0%{?with_python2} %package -n python2-%{pypi_name} Summary: A simple wrapper around optparse for powerful command line utilities Provides: python-click = %{version}-%{release} Obsoletes: python-click <= 4.0-1 %description -n python2-%{pypi_name} click is a Python 2 package for creating beautiful command line interfaces in a composable way with as little amount of code as necessary. It's the "Command Line Interface Creation Kit". It's highly configurable but comes with good defaults out of the box. %endif # with_python2 %if 0%{?with_python2} %package -n python3-%{pypi_name} Summary: A simple wrapper around optparse for powerful command line utilities %description -n python3-%{pypi_name} click is a Python 3 package for creating beautiful command line interfaces in a composable way with as little amount of code as necessary. It's the "Command Line Interface Creation Kit". It's highly configurable but comes with good defaults out of the box. %endif # with_python2 %prep %setup -q -n %{pypi_name}-%{version} %if 0%{?with_python2} rm -rf %{py2dir} cp -a . %{py2dir} %endif # with_python2 %if 0%{?with_python3} rm -rf %{py3dir} cp -a . %{py3dir} %endif # with_python3 %build %if 0%{?with_python2} pushd %{py2dir} %{__python2} setup.py build %endif # with_python2 %if 0%{?with_python3} pushd %{py3dir} %{__python3} setup.py build popd %endif # with_python3 %install # Must do the subpackages' 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 --skip-build --root %{buildroot} popd %endif # with_python3 %if 0%{?with_python2} pushd %{py2dir} %{__python2} setup.py install --skip-build --root %{buildroot} popd %endif # with_python2 %check %if 0%{?with_python2} pushd %{py2dir} PYTHONPATH=$(pwd) py.test-%{python2_version} tests --tb=long --verbose popd %endif %if 0%{?with_python3} pushd %{py3dir} LANG=en_GB.utf8 LC_ALL=en_GB.utf8 PYTHONPATH=$(pwd) py.test-%{python3_version} tests --tb=long --verbose popd %endif %files -n python2-%{pypi_name} %doc README %{python2_sitelib}/%{pypi_name} %{python2_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info %if 0%{?with_python3} %files -n python3-%{pypi_name} %doc README %{python3_sitelib}/%{pypi_name} %{python3_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info %endif # with_python3 %changelog * Fri May 22 2015 Robert Kuska <rkuska@redhat.com> - 4.0-2 - Split to subpackages * Wed Apr 01 2015 Robert Kuska <rkuska@redhat.com> - 4.0-1 - Update to 4.0