%{!?dotests: %define dotests 1}
%define name python3-pluggy
%define srcname pluggy 
%define version 0.13.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 && 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: Better living through Python with decorators
Name: %{name}
Version: %{version}
Release: %{release}
Source0: %{srcname}-%{version}.tar.gz
License: BSD License
Group: Development/Libraries
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
Prefix: %{_prefix}
BuildArch: noarch
Vendor: Michele Simionato <michele.simionato@gmail.com>
Url: http://pypi.python.org/pypi/decorator

BuildRequires: python3 >= 3.7.4, python3-devel >= 3.7.4, python3-pytest >= 5.3.1
Requires: python3 >= 3.7.4, python3-importlib-metadata >= 0.23  


%description
This is the plugin manager as used by pytest but stripped of pytest specific details.

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

%build
python3 setup.py build
if [ "%{dotests}" == 1 ]
then
    PYTHONPATH=$PWD python3 -m pytest testing -k "not test_load_setuptools_instantiation"
fi
	
%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 32bit/PKG-INFO 32bit/README.txt
%doc README.rst
%license LICENSE
#%{python_sitelib}/%{srcname}.py
#%{python_sitelib}/%{srcname}.pyc
#%{python_sitelib}/%{srcname}.pyo
#%{python_sitelib}/*.egg-info
%{python_sitelib}/*

%changelog
* Tue Dec 24 2019 Ashwini Chandrappa<ashwic22@in.ibm.com> -0.13.0
-Build with python3
* Thu Sep 21 2017 Ravi Hirekurabar <rhirekur@in.ibm.com> -0.4.0
- Initial Port
