Blob Blame History Raw
%global upname argh

Name:		python-%{upname}
Version:	0.26.1
Release:	3%{?dist}
Summary:	Unobtrusive argparse wrapper with natural syntax

License:	LGPLv3+
URL:		https://pypi.python.org/pypi/%{upname}
Source0:	https://pypi.python.org/packages/source/a/%{upname}/%{upname}-%{version}.tar.gz
Source1:	https://www.gnu.org/licenses/lgpl-3.0.txt
Source2:	https://www.gnu.org/licenses/gpl-3.0.txt

# not upstreamed, fixes an assert in testsuite.
Patch0001:	python-argh-0.26.1-fix-testsuite.patch

BuildArch:	noarch

BuildRequires:	pytest
BuildRequires:	python2-devel
BuildRequires:	python-mock
BuildRequires:	python-pytest
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
%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.

%if 0%{?fedora} >= 24 || 0%{?rhel} >= 8
%package -n python2-%{upname}
Summary:	Unobtrusive argparse wrapper with natural syntax

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?

%{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

%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?

%{name} provides a wrapper for argparse.  Argparse is a very
powerful tool;  %{name} just makes it easy to use.
%endif


%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} .


%build
%{__python} setup.py build

%if 0%{?fedora} || 0%{?rhel} >= 8
pushd %{py3dir}
%{__python3} setup.py build
%endif


%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


%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}
%{__python3} setup.py test
%endif


%if 0%{?fedora} || 0%{?rhel} >= 8
%files -n python2-%{upname}
%else
%files
%endif
%doc README.rst
%license COPYING gpl-3.0.txt
%{python_sitelib}/*

%if 0%{?fedora} || 0%{?rhel} >= 8
%files -n python3-%{upname}
%doc README.rst
%license COPYING gpl-3.0.txt
%{python3_sitelib}/*
%endif


%changelog
* Tue Dec 20 2016 Miro Hrončok <mhroncok@redhat.com> - 0.26.1-3
- Rebuild for Python 3.6

* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org>
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Mon Feb 08 2016 Björn Esser <fedora@besser82.io> - 0.26.1-1
- new upstream-release (#1301580)

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.23.2-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Fri Nov 06 2015 Robert Kuska <rkuska@redhat.com> - 0.23.2-5
- Rebuilt for Python3.5 rebuild

* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.23.2-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.23.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Tue May 27 2014 Kalev Lember <kalevlember@gmail.com> - 0.23.2-2
- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4

* Mon Aug 12 2013 Björn Esser <bjoern.esser@gmail.com> - 0.23.2-1
- Initial rpm release (#996186)