You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
python-click/python-click.spec

114 lines
3.1 KiB

# Created by pyp2rpm-1.0.1
%global pypi_name click
%global with_python3 1
%global py2v %(%{__python2} -c "import sys; print('{}.{}'.format(sys.version_info[0], sys.version_info[1]))")
%global py3v %(%{__python3} -c "import sys; print('{}.{}'.format(sys.version_info[0], sys.version_info[1]))")
Name: python-%{pypi_name}
Version: 1.1
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
# Tests are not included in pypi package, checked from github
Source1: click-%{version}-tests.tgz
BuildArch: noarch
BuildRequires: python-devel
BuildRequires: python-setuptools
BuildRequires: pytest
%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_python3}
%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_python3
%prep
%setup -q -n %{pypi_name}-%{version}
%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif # with_python3
%build
%{__python2} setup.py build
%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
%{__python2} setup.py install --skip-build --root %{buildroot}
%check
tar xzf %{SOURCE1}
PYTHONPATH=`pwd` py.test-%{py2v} tests --tb=long --verbose
%if 0%{?with_python3}
pushd %{py3dir}
tar xzf %{SOURCE1}
LANG=en_GB.utf8 LC_ALL=en_GB.utf8 PYTHONPATH=`pwd` py.test-%{py3v} tests --tb=long --verbose
popd
%endif
%files
%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
* Thu May 29 2014 Robert Kuska <rkuska@redhat.com> - 1.1-2
- Remove __pycache__ folder from tests
* Mon May 12 2014 Robert Kuska <rkuska@redhat.com> - 1.1-1
- Update source
* Wed May 07 2014 Robert Kuska <rkuska@redhat.com> - 0.6-1
- Initial package.