# this is only turned on during transitional periods
%{?python3_next_pkgversion: %global with_python3_next 1}

# Do not check .so files in the pythonX_sitearch directories.
%global __provides_exclude_from ^(%{python3_sitearch}|%{python3_next_sitearch})/.*\\.so$

%global tarname setproctitle

%global _description\
Python module allowing a process to change its title as displayed by\
system tool such as ps and top.\
\
It's useful in multiprocess systems, allowing to identify tasks each forked\
process is busy with. This technique has been used by PostgreSQL and OpenSSH.\
\
It's based on PostgreSQL implementation which has proven to be portable.


Name:		python3-setproctitle
Version:	1.1.6
Release:	2%{?dist}
Summary:	Python module to customize a process title

License:	BSD
URL:		https://pypi.python.org/pypi/%{tarname}
Source0:	https://pypi.python.org/packages/source/s/%{tarname}/%{tarname}-%{version}.tar.gz

BuildRequires:	python%{python3_pkgversion}-devel
BuildRequires:	python%{python3_pkgversion}-setuptools
#BuildRequires:	python%{python3_pkgversion}-nose

%description %_description

%if "python%{python3_pkgversion}-%{tarname}" != "%{name}"
%package -n python%{python3_pkgversion}-%{tarname}
Summary:	Python module to customize a process title

%description -n python%{python3_pkgversion}-%{tarname} %_description
%endif


%if 0%{?with_python3_next}
%package -n python%{python3_next_pkgversion}-%{tarname}
Summary:	Python module to customize a process title
BuildRequires:	python%{python3_next_pkgversion}-devel
BuildRequires:	python%{python3_next_pkgversion}-setuptools
BuildRequires:	python%{python3_next_pkgversion}-nose

%description -n python%{python3_next_pkgversion}-%{tarname} %_description
%endif


%prep
%autosetup -n %{tarname}-%{version} -p 1


%build
%py3_build
%if 0%{?with_python3_next}
%py3_next_build
%endif


%install
%py3_install
%{__chmod} 0755 %{buildroot}%{python3_sitearch}/setproctitle*.so
%if 0%{?with_python3_next}
%py3_next_install
%{__chmod} 0755 %{buildroot}%{python3_next_sitearch}/setproctitle*.so
%endif


%files -n python%{python3_pkgversion}-%{tarname}
%license COPYRIGHT
%doc README.rst
%{python3_sitearch}/*


%if 0%{?with_python3_next}
%files -n python%{python3_next_pkgversion}-%{tarname}
%license COPYRIGHT
%doc README.rst
%{python3_next_sitearch}/*
%endif

%changelog
* Thu Nov 16 2017 Björn Esser <besser82@fedoraproject.org> - 1.1.6-2
- Some packaging fixes

* Thu Aug 31 2017 Björn Esser <besser82@fedoraproject.org> - 1.1.6-1
- Initial rpm release for EPEL7 (rhbz#1487224)