Blob Blame History Raw
%global upname argh

Name:		python-%{upname}
Version:	0.23.2
Release:	2%{?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:	http://www.gnu.org/licenses/lgpl-3.0.txt

BuildArch:	noarch

BuildRequires:	pytest
BuildRequires:	python2-devel
BuildRequires:	python-mock
BuildRequires:	python-setuptools

# python == 2.6 needs
%{?el6:BuildRequires:	python-argparse}
%{?el6:Requires:	python-argparse}

%if 0%{?fedora} || 0%{?rhel} >= 7
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} || 0%{?rhel} >= 7
%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}

%if 0%{?fedora} || 0%{?rhel} >= 7
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif

install -pm 0644 %{SOURCE1} COPYING


%build
%{__python} setup.py build

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


%install
%{__python} setup.py install -O1 --skip-build --root %{buildroot}

%if 0%{?fedora} || 0%{?rhel} >= 7
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} >= 7
pushd %{py3dir}
%{__python3} setup.py test
%endif


%files
%doc COPYING README
%{python_sitelib}/*

%if 0%{?fedora} || 0%{?rhel} >= 7
%files -n python3-%{upname}
%doc COPYING README
%{python3_sitelib}/*
%endif


%changelog
* 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)