diff --git a/python-zdaemon.spec b/python-zdaemon.spec index f4dfcbf..9196848 100644 --- a/python-zdaemon.spec +++ b/python-zdaemon.spec @@ -1,16 +1,21 @@ -%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} +%if 0%{?rhel} && 0%{?rhel} <= 6 +%{!?__python2: %global __python2 /usr/bin/python2} +%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} +%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} +%endif -# TODO -- this is a likely candidate for python3 subpackaging +%if 0%{?fedora} +%global with_python3 1 +%endif Name: python-zdaemon Version: 4.0.0 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Python Daemon Process Control Library Group: Development/Languages License: ZPLv2.1 URL: http://pypi.python.org/pypi/zdaemon/ Source0: http://pypi.python.org/packages/source/z/zdaemon/zdaemon-%{version}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch BuildRequires: python-devel @@ -24,10 +29,31 @@ BuildRequires: python-mock Requires: python-ZConfig +%if 0%{?with_python3} +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-zope-testing +BuildRequires: python3-ZConfig +BuildRequires: python3-manuel +BuildRequires: python3-six +BuildRequires: python3-zc-customdoctests +BuildRequires: python3-mock +%endif %description Daemon process control library and tools for Unix-bases systems. +%if 0%{?with_python3} +%package -n python3-zdaemon +Summary: Python Daemon Process Control Library +Group: Development/Languages + +Requires: python3-ZConfig + +%description -n python3-zdaemon +Daemon process control library and tools for Unix-bases systems. +%endif + %prep %setup -q -n zdaemon-%{version} @@ -35,32 +61,61 @@ sed -i '1,1d' src/zdaemon/zdctl.py sed -i '1,1d' src/zdaemon/zdrun.py sed -i '1,1d' src/zdaemon/tests/nokill.py +%if 0%{?with_python3} +rm -rf %{py3dir} +cp -a . %{py3dir} +%endif %build -%{__python} setup.py build +%{__python2} setup.py build +%if 0%{?with_python3} +pushd %{py3dir} +%{__python3} setup.py build +popd +%endif %install -rm -rf $RPM_BUILD_ROOT -%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT +%if 0%{?with_python3} +pushd %{py3dir} +%{__python3} setup.py install -O1 --skip-build --root %{buildroot} +mv %{buildroot}%{_bindir}/zdaemon %{buildroot}%{_bindir}/python3-zdaemon +popd +%endif +%{__python2} setup.py install -O1 --skip-build --root %{buildroot} %check -export PYTHONPATH="$PYTHONPATH:$RPM_BUILD_ROOT%{python_sitelib}" -%{__python} build/lib/zdaemon/tests/tests.py +%if 0%{?with_python3} +pushd %{py3dir} +export PYTHONPATH="$PYTHONPATH:%{buildroot}%{python3_sitelib}" +%{__python3} build/lib/zdaemon/tests/tests.py +popd +%endif -%clean -rm -rf $RPM_BUILD_ROOT +export PYTHONPATH="$PYTHONPATH:%{buildroot}%{python2_sitelib}" +%{__python2} build/lib/zdaemon/tests/tests.py %files -%defattr(-,root,root,-) %doc CHANGES.txt README.txt -%{python_sitelib}/zdaemon -%{python_sitelib}/zdaemon-%{version}-py?.?.egg-info +%{python2_sitelib}/zdaemon +%{python2_sitelib}/zdaemon-%{version}-py?.?.egg-info %{_bindir}/zdaemon +%if 0%{?with_python3} +%files -n python3-zdaemon +%doc CHANGES.txt README.txt +%{python3_sitelib}/zdaemon +%{python3_sitelib}/zdaemon-%{version}-py?.?.egg-info +%{_bindir}/python3-zdaemon +%endif + %changelog +* Tue Jun 10 2014 Ralph Bean - 4.0.0-3 +- python3 subpackage added +- modernized python2 macros + * Sun Jun 08 2014 Fedora Release Engineering - 4.0.0-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild