Blob Blame History Raw
%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

%if 0%{?fedora}
%global with_python3 1
%endif

Name:           python-zdaemon
Version:        4.0.0
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

BuildArch:      noarch
BuildRequires:  python-devel
BuildRequires:  python-setuptools
BuildRequires:  python-zope-testing
BuildRequires:  python-ZConfig
BuildRequires:  python-manuel
BuildRequires:  python-six
BuildRequires:  python-zc-customdoctests
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}
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
%{__python2} setup.py build

%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif

%install
%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
%if 0%{?with_python3}
pushd %{py3dir}
export PYTHONPATH="$PYTHONPATH:%{buildroot}%{python3_sitelib}"
%{__python3} build/lib/zdaemon/tests/tests.py
popd
%endif

export PYTHONPATH="$PYTHONPATH:%{buildroot}%{python2_sitelib}"
%{__python2} build/lib/zdaemon/tests/tests.py

%files
%doc CHANGES.txt README.txt
%{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 <rbean@redhat.com> - 4.0.0-3
- python3 subpackage added
- modernized python2 macros

* Sun Jun 08 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.0.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Wed Jan 29 2014 Ralph Bean <rbean@redhat.com> - 4.0.0-1
- Latest upstream.

* Wed Jan 29 2014 Ralph Bean <rbean@redhat.com> - 3.0.5-3
- Enable tests.

* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.5-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Mon Feb 25 2013 Ralph Bean <rbean@redhat.com> - 3.0.5-1
- Latest upstream
- Disabled tests while waiting for python-zc-customdoctests

* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.4-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.4-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.4-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.4-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Thu Jul 22 2010 David Malcolm <dmalcolm@redhat.com> - 2.0.4-3
- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild

* Fri Oct 16 2009 Conrad Meyer <konrad@tylerc.org> - 2.0.4-2
- Add BR on python-setuptools.

* Wed Apr 22 2009 Conrad Meyer <konrad@tylerc.org> - 2.0.4-1
- Bump to 2.0.4.

* Mon Dec 15 2008 Conrad Meyer <konrad@tylerc.org> - 2.0.2-1
- Initial package.