Blob Blame Raw
%global pypi_name click

# pytest in base RHEL is too old
%bcond_with python2_tests

%bcond_without python3_tests

# pytest in EPEL hasn't been built for python3_other yet
%bcond_with python3_other_tests

Name:           python-%{pypi_name}
Version:        6.7
Release:        8%{?dist}
Summary:        Simple wrapper around optparse for powerful command line utilities

License:        BSD
URL:            https://github.com/mitsuhiko/click
Source0:        %{url}/archive/%{version}/%{pypi_name}-%{version}.tar.gz
# https://github.com/pallets/click/commit/20b4b1c0d1564ab4ef44b7d27d5b650735e28be3
Patch3:         update-tests-to-work-with-newer-pytest-versions.patch

BuildArch:      noarch

%global _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.

%description %{_description}

%package -n     python2-%{pypi_name}
Summary:        %{summary}
%{?python_provide:%python_provide python2-%{pypi_name}}
BuildRequires:  python2-devel
BuildRequires:  python2-setuptools
%{?with_python2_tests:BuildRequires: python2-pytest >= 2.8}

%description -n python2-%{pypi_name} %{_description}

%package -n     python%{python3_pkgversion}-%{pypi_name}
Summary:        %{summary}
%{?python_provide:%python_provide python%{python3_pkgversion}-%{pypi_name}}
BuildRequires:  python%{python3_pkgversion}-devel
BuildRequires:  python%{python3_pkgversion}-setuptools
%{?with_python3_tests:BuildRequires: python%{python3_pkgversion}-pytest >= 2.8}

%description -n python%{python3_pkgversion}-%{pypi_name} %{_description}

%package -n     python%{python3_other_pkgversion}-%{pypi_name}
Summary:        %{summary}
BuildRequires:  python%{python3_other_pkgversion}-devel
BuildRequires:  python%{python3_other_pkgversion}-setuptools
%{?with_python3_other_tests:BuildRequires: python%{python3_other_pkgversion}-pytest >= 2.8}

%description -n python%{python3_other_pkgversion}-%{pypi_name} %{_description}

%prep
%autosetup -n %{pypi_name}-%{version} -p1

%build
%py2_build
%py3_build
%py3_other_build

%install
%py2_install
%py3_install
%py3_other_install

%check
export LC_ALL=en_US.UTF-8
%{?with_python2_tests:PYTHONPATH=%{buildroot}%{python2_sitelib} py.test-%{python2_version} tests --verbose}
%{?with_python3_tests:PYTHONPATH=%{buildroot}%{python3_sitelib} py.test-%{python3_version} tests --verbose}
%{?with_python3_other_tests:PYTHONPATH=%{buildroot}%{python3_other_sitelib} py.test-%{python3_other_version} tests --verbose}

%files -n python2-%{pypi_name}
%license LICENSE
%doc README CHANGES
%{python2_sitelib}/%{pypi_name}
%{python2_sitelib}/%{pypi_name}-%{version}-py%{python2_version}.egg-info

%files -n python%{python3_pkgversion}-%{pypi_name}
%license LICENSE
%doc README CHANGES
%{python3_sitelib}/%{pypi_name}
%{python3_sitelib}/%{pypi_name}-%{version}-py%{python3_version}.egg-info

%files -n python%{python3_other_pkgversion}-%{pypi_name}
%license LICENSE
%doc README CHANGES
%{python3_other_sitelib}/%{pypi_name}
%{python3_other_sitelib}/%{pypi_name}-%{version}-py%{python3_other_version}.egg-info

%changelog
* Thu Mar 07 2019 Troy Dawson <tdawson@redhat.com> - 6.7-8
- Rebuilt to change main python from 3.4 to 3.6

* Mon Oct 08 2018 Carl George <carl@george.computer> - 6.7-7
- Add python3_other subpackage
- Backport upstream commit for newer pytest compatibility

* Thu Oct 12 2017 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 6.7-6
- Fixup EPEL packaging
- Adopt to packaging guidelines

* Thu Oct 12 2017 Carl George <carl@george.computer> - 6.7-6
- Add EPEL compatibility

* Tue Mar 08 2016 Robert Kuska <rkuska@redhat.com> - 6.3-1
- Update to 6.3

* Fri Oct 03 2014 Robert Kuska <rkuska@redhat.com> - 3.3-1
- Update to 3.3

* Mon Jun 30 2014 Robert Kuska <rkuska@redhat.com> - 2.2-1
- Update to 2.2

* Thu Jun 12 2014 Robert Kuska <rkuska@redhat.com> - 2.0-2
- Change spec for epel7

* Thu Jun 12 2014 Robert Kuska <rkuska@redhat.com> - 2.0-1
- Update to 2.0

* Fri Jun 06 2014 Robert Kuska <rkuska@redhat.com> - 1.1-3
- Make click own its folder
- Use pythonX_version macros from devel package

* 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.