%define name python3-argparse
%define srcname argparse
%define version 1.4.0
%define release 1

%define is_python %(test -e /usr/bin/python3_32 && echo 1 || echo 0)
%if %{is_python}
%define python_sitelib %(python3_32 -c "from distutils.sysconfig import get_python_lib; print (get_python_lib(1))")
%endif

%define _libdir64 %{_prefix}/lib64

%define is_python_64 %(test -e /usr/bin/python3_64 && echo 1 || echo 0)
%if %{is_python_64}
%define python_sitelib64 %(python3 -c "from distutils.sysconfig import get_python_lib; print (get_python_lib(1))")
%endif

Summary: HTTP library, written in Python, for human beings
Name: %{name}
Version: %{version}
Release: %{release}
Source0: https://code.google.com/p/argparse/downloads/list/%{srcname}-%{version}.tar.gz
Url:     http://code.google.com/p/argparse
License: Python
Group: Development/Languages
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
Prefix: %{_prefix}

BuildRequires: python3 >= 3.7.3
BuildRequires: python3-devel >= 3.7.3
BuildArch:     noarch

%description

The argparse module is an optparse-inspired command line parser that
improves on optparse by:
 * handling both optional and positional arguments
 * supporting parsers that dispatch to sub-parsers
 * producing more informative usage messages
 * supporting actions that consume any number of command-line args
 * allowing types and actions to be specified with simple callables
    instead of hacking class attributes like STORE_ACTIONS or CHECK_METHODS

as well as including a number of other more minor improvements on the
optparse API.


%prep
%setup -q -n %{srcname}-%{version}

%build
python3 setup.py build

%check
cd test
PYTHONPATH=../ python3 test_argparse.py

%install
[ -d "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT

python3 setup.py install --skip-build --root ${RPM_BUILD_ROOT}

%clean
[ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT}

%files
%defattr(-,root,system,-)
%doc LICENSE.txt NEWS.txt README.txt 
%{python_sitelib}/*

%changelog
* Tue Nov 05 2019 Baanu Tumma <btumma15@in.ibm.com> - 1.4.0-1
- Update to latest version for python3 

* Wed May 25 2016 Ravi Hirekurabar <rhirekur@in.ibm.com> - 1.2.1-1
- first version for AIX V6.1 and higher
