From 63d7f3212270e4e47fef4390b46fa087c2f557b4 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Nov 30 2015 18:00:00 +0000 Subject: Update to newer upstream. - Create a python3 subpackage since upstream supports it - Note that newer upstream has relicensed to Apache 2.0 --- diff --git a/python-daemon-mock.patch b/python-daemon-mock.patch new file mode 100644 index 0000000..f9f7afa --- /dev/null +++ b/python-daemon-mock.patch @@ -0,0 +1,75 @@ +Index: python-daemon-2.0.6/test/test_daemon.py +=================================================================== +--- python-daemon-2.0.6.orig/test/test_daemon.py ++++ python-daemon-2.0.6/test/test_daemon.py +@@ -32,7 +32,12 @@ except ImportError: + # Standard library of Python 2.6 and earlier. + from StringIO import StringIO + +-import mock ++try: ++ # Python 3 ++ from unittest import mock ++except ImportError: ++ # Python 2 ++ import mock + + from . import scaffold + from .scaffold import (basestring, unicode) +Index: python-daemon-2.0.6/test/test_metadata.py +=================================================================== +--- python-daemon-2.0.6.orig/test/test_metadata.py ++++ python-daemon-2.0.6/test/test_metadata.py +@@ -29,7 +29,13 @@ import collections + import json + + import pkg_resources +-import mock ++try: ++ # Python 3 ++ from unittest import mock ++except ImportError: ++ # Python 2 ++ import mock ++ + import testtools.helpers + import testtools.matchers + import testscenarios +Index: python-daemon-2.0.6/test/test_pidfile.py +=================================================================== +--- python-daemon-2.0.6.orig/test/test_pidfile.py ++++ python-daemon-2.0.6/test/test_pidfile.py +@@ -33,7 +33,13 @@ except ImportError: + # Standard library of Python 2.6 and earlier. + from StringIO import StringIO + +-import mock ++try: ++ # Python 3 ++ from unittest import mock ++except ImportError: ++ # Python 2 ++ import mock ++ + import lockfile + + from . import scaffold +Index: python-daemon-2.0.6/test/test_runner.py +=================================================================== +--- python-daemon-2.0.6.orig/test/test_runner.py ++++ python-daemon-2.0.6/test/test_runner.py +@@ -30,7 +30,13 @@ import signal + import functools + + import lockfile +-import mock ++try: ++ # Python 3 ++ from unittest import mock ++except ImportError: ++ # Python 2 ++ import mock ++ + import testtools + + from . import scaffold diff --git a/python-daemon.spec b/python-daemon.spec index 89e28ff..efa1dc8 100644 --- a/python-daemon.spec +++ b/python-daemon.spec @@ -1,50 +1,117 @@ -%{!?pyver: %define pyver %(%{__python} -c "import sys ; print sys.version[:3]")} + +# 24 picked since that's when the package was updated to contain a version +# capable of python3. If we're willing to push the update to older Fedora +# releases, the python3 package can go to older releases as well. +%if 0%{?fedora} >= 23 +%global with_python3 1 +%else +%global with_python3 0 +%endif Name: python-daemon -Version: 1.6 -Release: 8%{?dist} +Version: 2.0.6 +Release: 1%{?dist} Summary: Library to implement a well-behaved Unix daemon process Group: Development/Languages -License: Python +# Some build scripts and test franework are licensed GPLv3+ but htose aren't shipped +License: ASL2.0 URL: http://pypi.python.org/pypi/python-daemon/ Source0: http://pypi.python.org/packages/source/p/python-daemon/%{name}-%{version}.tar.gz +Patch0: python-daemon-mock.patch BuildArch: noarch BuildRequires: python-devel, python-setuptools -BuildRequires: python-nose -BuildRequires: python-lockfile python-minimock +BuildRequires: python-testscenarios +BuildRequires: python-lockfile +BuildRequires: python-mock +BuildRequires: python-docutils +%if 0%{?with_python3} +BuildRequires: python3-devel, python3-setuptools +BuildRequires: python3-testscenarios +BuildRequires: python3-docutils +BuildRequires: python3-lockfile +BuildRequires: python3-mock +BuildRequires: python3-testtools +%endif Requires: python-lockfile %description This library implements the well-behaved daemon specification of PEP 3143, "Standard daemon process library". +This is the python2 version of the library. + +%if 0%{?with_python3} +%package -n python3-daemon +Summary: Library to implement a well-behaved Unix daemon process +Requires: python3-lockfile + +%description -n python3-daemon +This library implements the well-behaved daemon specification of PEP 3143, +"Standard daemon process library". + +This is the python3 version of the library. +%endif + %prep %setup -q -sed -i -e '/^#!\//, 1d' daemon/version/version_info.py +%patch0 -p1 +%if 0%{?with_python3} +rm -rf %{py3dir} +cp -ar . %{py3dir} +%endif %build -%{__python} setup.py build +%{__python2} setup.py build +%if 0%{?with_python3} +pushd %{py3dir} +%{__python3} setup.py build +popd +%endif %install -%{__python} setup.py install -O1 --skip-build --root %{buildroot} -rm -fr %{buildroot}%{python_sitelib}/tests +%{__python2} setup.py install --skip-build --root %{buildroot} +rm -fr %{buildroot}%{python2_sitelib}/tests + +%if 0%{?with_python3} +pushd %{py3dir} +%{__python3} setup.py install --skip-build --root %{buildroot} +rm -fr %{buildroot}%{python3_sitelib}/tests +popd +%endif # Test suite requires minimock and lockfile %check -PYTHONPATH=$(pwd) nosetests +PYTHONPATH=$(pwd) %{__python2} -m unittest discover + +%if 0%{?with_python3} +pushd %{py3dir} +PYTHONPATH=$(pwd) %{__python3} -m unittest discover +%endif %files -%doc LICENSE.PSF-2 -%{python_sitelib}/daemon/ -%{python_sitelib}/python_daemon-%{version}-py%{pyver}.egg-info/ +%license LICENSE.ASF-2 +%{python2_sitelib}/daemon/ +%{python2_sitelib}/python_daemon-%{version}-py%{python2_version}.egg-info/ + +%if 0%{?with_python3} +%files -n python3-daemon +%license LICENSE.ASF-2 +%{python3_sitelib}/daemon/ +%{python3_sitelib}/python_daemon-%{version}-py%{python3_version}.egg-info/ +%endif %changelog +* Sat Nov 14 2015 Toshio Kuratomi - - 2.0.6-1 +- Update to newer upstream. +- Create a python3 subpackage since upstream supports it +- Note that newer upstream has relicensed to Apache 2.0 + * Thu Jun 18 2015 Fedora Release Engineering - 1.6-8 - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild