d2a842
%if 0%{?fedora} > 12
d2a842
%global with_python3 1
d2a842
%else
d2a842
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
d2a842
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
d2a842
%endif
d2a842
d2a842
d2a842
%global tarname setproctitle
d2a842
d2a842
Name:           python-setproctitle
d2a842
Version:        1.1.6
88023e
Release:        5%{?dist}
d2a842
Summary:        Python module to customize a process title
d2a842
d2a842
License:        BSD
d2a842
URL:            http://pypi.python.org/pypi/%{tarname}
d2a842
Source0:        http://pypi.python.org/packages/source/s/%{tarname}/%{tarname}-%{version}.tar.gz
d2a842
d2a842
BuildRequires:  python2-devel
d2a842
BuildRequires:  python-setuptools
d2a842
BuildRequires:  python-nose
d2a842
BuildRequires:  python-tools
d2a842
%{?filter_setup:
d2a842
%filter_provides_in %{python_sitearch}/.*\.so$
d2a842
%filter_setup
d2a842
}
d2a842
d2a842
d2a842
%description
d2a842
Python module allowing a process to change its title as displayed by
d2a842
system tool such as ps and top.
d2a842
d2a842
It's useful in multiprocess systems, allowing to identify tasks each forked
d2a842
process is busy with. This technique has been used by PostgreSQL and OpenSSH.
d2a842
d2a842
It's based on PostgreSQL implementation which has proven to be portable.
d2a842
d2a842
d2a842
d2a842
%if 0%{?with_python3}
d2a842
%package -n python3-%{tarname}
d2a842
Summary:        Python module to customize a process title
d2a842
BuildRequires:  python3-devel
d2a842
BuildRequires:  python3-setuptools
d2a842
BuildRequires:  python3-nose
d2a842
d2a842
%description -n python3-%{tarname}
d2a842
Python module allowing a process to change its title as displayed by
d2a842
system tool such as ps and top.
d2a842
d2a842
It's useful in multi-process systems, allowing to identify tasks each forked
d2a842
process is busy with. This technique has been used by PostgreSQL and OpenSSH.
d2a842
d2a842
It's based on PostgreSQL implementation which has proven to be portable.
d2a842
%endif
d2a842
d2a842
%prep
d2a842
%setup -q -n %{tarname}-%{version}
d2a842
%{?with_python3: cp -a . %{py3dir}}
d2a842
d2a842
d2a842
%build
d2a842
# Remove CFLAGS=... for noarch packages (unneeded)
d2a842
CFLAGS="%{optflags}" %{__python} setup.py build
d2a842
%if 0%{?with_python3}
d2a842
pushd %{py3dir}
d2a842
CFLAGS="%{optflags}" %{__python3} setup.py build
d2a842
popd
d2a842
%endif
d2a842
d2a842
%install
d2a842
%{__python} setup.py install -O1 --skip-build --root %{buildroot}
d2a842
chmod 0755 %{buildroot}%{python_sitearch}/setproctitle.so
d2a842
%if 0%{?with_python3}
d2a842
pushd %{py3dir}
d2a842
CFLAGS="%{optflags}" %{__python3} setup.py install -O1 --skip-build --root %{buildroot}
d2a842
popd
d2a842
chmod 0755 %{buildroot}%{python3_sitearch}/setproctitle*.so
d2a842
%endif
d2a842
d2a842
%check
d2a842
make tests/pyrun2
d2a842
# FIXME: tests are broken with python3
d2a842
%if 0%{?with_python3}
d2a842
pushd %{py3dir}
d2a842
BUILD_DIR=$(%{__python3} -c "import sys; import platform; \
d2a842
print('build/lib.linux-{0}-{1}.{2}'.format(platform.machine(), \
d2a842
sys.version_info[0], sys.version_info[1]))")
d2a842
# looks like tests are not 2to3'ed by setup.py
d2a842
2to3 -w --no-diffs tests
d2a842
gcc `pkg-config --cflags --libs python3` -o tests/pyrun3 tests/pyrun.c
d2a842
PYTHONPATH=$BUILD_DIR:$PYTHONPATH ROOT_PATH=$(pwd) \
d2a842
                                  %{__python3} tests/setproctitle_test.py -v || :
d2a842
popd
d2a842
%endif
d2a842
d2a842
d2a842
%files
d2a842
%doc README.rst COPYRIGHT
d2a842
# For arch-specific packages: sitearch
d2a842
%{python_sitearch}/*
d2a842
d2a842
%if 0%{?with_python3}
d2a842
%files -n python3-%{tarname}
d2a842
%doc README.rst COPYRIGHT
d2a842
# For arch-specific packages: sitearch
d2a842
%{python3_sitearch}/*
d2a842
%endif
d2a842
d2a842
%changelog
88023e
* Fri Jan 24 2014 Daniel Mach <dmach@redhat.com> - 1.1.6-5
88023e
- Mass rebuild 2014-01-24
88023e
88023e
* Fri Dec 27 2013 Daniel Mach <dmach@redhat.com> - 1.1.6-4
88023e
- Mass rebuild 2013-12-27
88023e
d2a842
* Wed Aug 7 2013 Andy Grover <agrover@redhat.com> - 1.1.6-3
d2a842
- Remove with_python3 if rhel > 6
d2a842
d2a842
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.6-2
d2a842
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
d2a842
d2a842
* Sat Aug  4 2012 Haïkel Guémar <hguemar@fedoraproject.org> - 1.1.6-1
d2a842
- upstream 1.1.6
d2a842
d2a842
* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.3-3
d2a842
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
d2a842
d2a842
* Mon Mar 05 2012 Haïkel Guémar <hguemar@fedoraproject.org> - 1.1.3-2
d2a842
- enable tests execution
d2a842
- spec cleaning
d2a842
d2a842
* Sun Jan 29 2012 Haïkel Guémar <hguemar@fedoraproject.org> - 1.1.3-1
d2a842
- initial packaging
d2a842