diff --git a/python-argh.spec b/python-argh.spec index e535e7e..34ce1b5 100644 --- a/python-argh.spec +++ b/python-argh.spec @@ -1,13 +1,28 @@ -%global upname argh - -Name: python-%{upname} +%if 0%{?fedora} || 0%{?rhel} >= 8 +%bcond_without python3 +%else # 0#{?fedora} || 0#{?rhel} >= 8 +%bcond_with python3 +%endif # 0#{?fedora} || 0#{?rhel} >= 8 + +%global pypi_name argh +%global global_sum Unobtrusive argparse wrapper with natural syntax +%global global_desc \ +Building a command-line interface? Found yourself uttering “argh!” \ +while struggling with the API of argparse? Don’t want to lose its \ +power but don’t need the complexity? \ + \ +%{name} provides a wrapper for argparse. Argparse is a very powerful \ +tool; %{name} just makes it easy to use. + + +Name: python-%{pypi_name} Version: 0.26.1 -Release: 4%{?dist} -Summary: Unobtrusive argparse wrapper with natural syntax +Release: 5%{?dist} +Summary: %{global_sum} License: LGPLv3+ -URL: https://pypi.python.org/pypi/%{upname} -Source0: https://pypi.python.org/packages/source/a/%{upname}/%{upname}-%{version}.tar.gz +URL: https://pypi.python.org/pypi/%{pypi_name} +Source0: https://pypi.python.org/packages/source/a/%{pypi_name}/%{pypi_name}-%{version}.tar.gz Source1: https://www.gnu.org/licenses/lgpl-3.0.txt Source2: https://www.gnu.org/licenses/gpl-3.0.txt @@ -16,123 +31,97 @@ Patch0001: python-argh-0.26.1-fix-testsuite.patch BuildArch: noarch -BuildRequires: pytest +%description +%{global_desc} + + +%package -n python2-%{pypi_name} +Summary: %{global_sum} + BuildRequires: python2-devel BuildRequires: python-mock +%if %{with python3} BuildRequires: python-pytest +%else # with python3 +BuildRequires: pytest +%endif # with python3 BuildRequires: python-setuptools - -# python == 2.6 needs -%{?el6:BuildRequires: python-argparse} -%{?el6:Requires: python-argparse} - -%if 0%{?fedora} || 0%{?rhel} >= 8 -BuildRequires: python3-devel -BuildRequires: python3-mock -BuildRequires: python3-pytest -BuildRequires: python3-setuptools +%if 0%{?rhel} && 0%{?rhel} <= 6 +BuildRequires: python-argparse +Requires: python-argparse %endif -%description -Building a command-line interface? Found yourself uttering “argh!” while -struggling with the API of argparse? Don’t want to lose its power but don’t -need the complexity? - -%{name} provides a wrapper for argparse. Argparse is a very -powerful tool; %{name} just makes it easy to use. +%{?python_provide:%python_provide python2-%{pypi_name}} -%if 0%{?fedora} >= 24 || 0%{?rhel} >= 8 -%package -n python2-%{upname} -Summary: Unobtrusive argparse wrapper with natural syntax +%description -n python2-%{pypi_name} +%{global_desc} -Provides: python-%{upname} == %{version}-%{release} -Obsoletes: python-%{upname} <= 0.26 -%description -n python2-%{upname} -Building a command-line interface? Found yourself uttering “argh!” while -struggling with the API of argparse? Don’t want to lose its power but don’t -need the complexity? +%if %{with python3} +%package -n python3-%{pypi_name} +Summary: %{global_sum} -%{name} provides a wrapper for argparse. Argparse is a very -powerful tool; %{name} just makes it easy to use. -%endif - -%if 0%{?fedora} || 0%{?rhel} >= 8 -%package -n python3-%{upname} -Summary: Unobtrusive argparse wrapper with natural syntax +BuildRequires: python3-devel +BuildRequires: python3-mock +BuildRequires: python3-pytest +BuildRequires: python3-setuptools -%description -n python3-%{upname} -Building a command-line interface? Found yourself uttering “argh!” while -struggling with the API of argparse? Don’t want to lose its power but don’t -need the complexity? +%{?python_provide:%python_provide python3-%{pypi_name}} -%{name} provides a wrapper for argparse. Argparse is a very -powerful tool; %{name} just makes it easy to use. -%endif +%description -n python3-%{pypi_name} +%{global_desc} +%endif # with python3 %prep -%setup -qn %{upname}-%{version} - -%patch1 -p1 -b .testsuite - -%if 0%{?fedora} || 0%{?rhel} >= 8 -rm -rf %{py3dir} -cp -a . %{py3dir} -%endif - -install -pm 0644 %{SOURCE1} COPYING -install -pm 0644 %{SOURCE2} . +%autosetup -n %{pypi_name}-%{version} +%{__install} -pm 0644 %{SOURCE1} COPYING +%{__install} -pm 0644 %{SOURCE2} . %build -%{__python} setup.py build - -%if 0%{?fedora} || 0%{?rhel} >= 8 -pushd %{py3dir} -%{__python3} setup.py build -%endif +%py2_build +%if %{with python3} +%py3_build +%endif # with python3 %install -%{__python} setup.py install -O1 --skip-build --root %{buildroot} - -%if 0%{?fedora} || 0%{?rhel} >= 8 -pushd %{py3dir} -%{__python3} setup.py install -O1 --skip-build --root %{buildroot} -%endif +%if %{with python3} +%py3_install +%endif # with python3 +%py2_install %check # tests need UTF-8 encoding -export LC_CTYPE="en_US.UTF-8" - -%{__python} setup.py test - -%if 0%{?fedora} || 0%{?rhel} >= 8 -pushd %{py3dir} +LANG="en_US.UTF-8" +LC_CTYPE="en_US.UTF-8" +export LANG LC_CTYPE +%{__python2} setup.py test +%if %{with python3} %{__python3} setup.py test -%endif +%endif # with python3 -%if 0%{?fedora} || 0%{?rhel} >= 8 -%files -n python2-%{upname} -%else -%files -%endif +%files -n python2-%{pypi_name} %doc README.rst %license COPYING gpl-3.0.txt -%{python_sitelib}/* +%{python2_sitelib}/* -%if 0%{?fedora} || 0%{?rhel} >= 8 -%files -n python3-%{upname} + +%if %{with python3} +%files -n python3-%{pypi_name} %doc README.rst %license COPYING gpl-3.0.txt %{python3_sitelib}/* -%endif +%endif # with python3 %changelog +* Tue Jun 20 2017 Björn Esser - 0.26.1-5 +- Adapt spec-file to recent guidelines + * Sat Feb 11 2017 Fedora Release Engineering - 0.26.1-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild