#
# Conditional build:
-%bcond_without tests # do not perform "make test"
+%bcond_without doc # Sphinx documentation
+%bcond_without tests # py.test tests
%bcond_without python2 # CPython 2.x module
%bcond_without python3 # CPython 3.x module
%define module click
Summary: A simple wrapper around optparse for powerful command line utilities
+Summary(pl.UTF-8): Proste obudowanie optparse do tworzenia potężnych narzędzi linii poleceń
Name: python-%{module}
Version: 6.7
-Release: 1
+Release: 2
License: BSD
Group: Libraries/Python
Source0: https://github.com/pallets/click/archive/%{version}.tar.gz
# Source0-md5: 3cae45d064f341b3f373489d8f7745e9
URL: http://click.pocoo.org/
-BuildRequires: rpm-pythonprov
-BuildRequires: rpmbuild(macros) >= 1.714
+%if %{with tests} && %(locale -a | grep -q '^C\.UTF-8$'; echo $?)
+BuildRequires: glibc-localedb-all
+%endif
%if %{with python2}
-BuildRequires: python-modules
+BuildRequires: python-modules >= 2
BuildRequires: python-pytest
BuildRequires: python-setuptools
%endif
%if %{with python3}
-BuildRequires: python3-modules
+BuildRequires: python3-modules >= 1:3.2
BuildRequires: python3-pytest
BuildRequires: python3-setuptools
%endif
+BuildRequires: rpm-pythonprov
+BuildRequires: rpmbuild(macros) >= 1.714
+%if %{with doc}
+BuildRequires: sphinx-pdg-2
+%endif
+Requires: python-modules >= 2
BuildArch: noarch
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
necessary. It's the "Command Line Interface Creation Kit". It's highly
configurable but comes with good defaults out of the box.
+%description -l pl.UTF-8
+click to pakiet Pythona do tworzenia ładnych interfejsów linii poleceń
+w uporządkowany sposób, przy użyciu jak najmniejszej ilości kodu.
+Nazwa "click" pochodzi od "Command Line Interface Creation Kit"
+(zestaw do tworzenia interfejsu linii poleceń). Jest wysoce
+konfigurowalny, ale ma dobre ustawienia domyślne.
+
%package -n python3-%{module}
Summary: A simple wrapper around optparse for powerful command line utilities
+Summary(pl.UTF-8): Proste obudowanie optparse do tworzenia potężnych narzędzi linii poleceń
Group: Libraries/Python
+Requires: python3-modules >= 1:3.2
%description -n python3-%{module}
click is a Python 3 package for creating beautiful command line
necessary. It's the "Command Line Interface Creation Kit". It's highly
configurable but comes with good defaults out of the box.
+%description -n python3-%{module} -l pl.UTF-8
+click to pakiet Pythona do tworzenia ładnych interfejsów linii poleceń
+w uporządkowany sposób, przy użyciu jak najmniejszej ilości kodu.
+Nazwa "click" pochodzi od "Command Line Interface Creation Kit"
+(zestaw do tworzenia interfejsu linii poleceń). Jest wysoce
+konfigurowalny, ale ma dobre ustawienia domyślne.
+
+%package apidocs
+Summary: Documentation for Python click module
+Summary(pl.UTF-8): Dokumentacja do modułu Pythona click
+Group: Documentation
+
+%description apidocs
+Documentation for Python click module.
+
+%description apidocs -l pl.UTF-8
+Dokumentacja do modułu Pythona click.
+
%prep
%setup -q -n %{module}-%{version}
%if %{with python3}
%py3_build
%if %{with tests}
-LANG=en_GB.utf8 LC_ALL=en_GB.utf8 PYTHONPATH=$(pwd) py.test-%{py3_ver} tests --tb=long --verbose
+LC_ALL=C.UTF-8 PYTHONPATH=$(pwd) py.test-%{py3_ver} tests --tb=long --verbose
%endif
%endif
+%if %{with doc}
+# click-specific code is not python3 ready
+%{__make} -C docs html \
+ SPHINXBUILD=sphinx-build-2
+%endif
+
%install
rm -rf $RPM_BUILD_ROOT
+
%if %{with python2}
%py_install
%py_postclean
%if %{with python2}
%files
%defattr(644,root,root,755)
-%doc README
+%doc CHANGES LICENSE README
%{py_sitescriptdir}/%{module}
%{py_sitescriptdir}/%{module}-%{version}-py*.egg-info
%endif
%if %{with python3}
%files -n python3-%{module}
%defattr(644,root,root,755)
-%doc README
+%doc CHANGES LICENSE README
%{py3_sitescriptdir}/%{module}
%{py3_sitescriptdir}/%{module}-%{version}-py*.egg-info
%endif
+
+%if %{with doc}
+%files apidocs
+%defattr(644,root,root,755)
+%doc docs/_build/html/{_static,*.html,*.js}
+%endif