From d4b4f9348d778ef3d680d35c3fa0d60486b119bb3070101460d9e6c26a10b6e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Thu, 30 Apr 2020 07:58:45 +0000 Subject: [PATCH 1/2] - Add patch to fix test running without python2 * no-python2.patch OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-daemonize?expand=0&rev=10 --- no-python2.patch | 84 ++++++++++++++++++++++++++++++++++++++++ python-daemonize.changes | 6 +++ python-daemonize.spec | 5 ++- 3 files changed, 93 insertions(+), 2 deletions(-) create mode 100644 no-python2.patch diff --git a/no-python2.patch b/no-python2.patch new file mode 100644 index 0000000..8d91706 --- /dev/null +++ b/no-python2.patch @@ -0,0 +1,84 @@ +Index: daemonize-2.5.0/tests/test.py +=================================================================== +--- daemonize-2.5.0.orig/tests/test.py ++++ daemonize-2.5.0/tests/test.py +@@ -3,6 +3,7 @@ import os + import pwd + import grp + import subprocess ++import sys + + from tempfile import mkstemp + from time import sleep +@@ -18,7 +19,7 @@ else: + class DaemonizeTest(unittest.TestCase): + def setUp(self): + self.pidfile = mkstemp()[1] +- os.system("python tests/daemon_sigterm.py %s" % self.pidfile) ++ os.system(sys.executable + " tests/daemon_sigterm.py %s" % self.pidfile) + sleep(.1) + + def tearDown(self): +@@ -43,7 +44,7 @@ class LockingTest(unittest.TestCase): + def setUp(self): + self.pidfile = mkstemp()[1] + print("First daemonize process started") +- os.system("python tests/daemon_sigterm.py %s" % self.pidfile) ++ os.system(sys.executable + " tests/daemon_sigterm.py %s" % self.pidfile) + sleep(.1) + + def tearDown(self): +@@ -53,7 +54,7 @@ class LockingTest(unittest.TestCase): + def test_locking(self): + sleep(10) + print("Attempting to start second daemonize process") +- proc = subprocess.call(["python", "tests/daemon_sigterm.py", self.pidfile]) ++ proc = subprocess.call([sys.executable, "tests/daemon_sigterm.py", self.pidfile]) + self.assertEqual(proc, 1) + + +@@ -61,7 +62,7 @@ class KeepFDsTest(unittest.TestCase): + def setUp(self): + self.pidfile = mkstemp()[1] + self.logfile = mkstemp()[1] +- os.system("python tests/daemon_keep_fds.py %s %s" % (self.pidfile, self.logfile)) ++ os.system(sys.executable + " tests/daemon_keep_fds.py %s %s" % (self.pidfile, self.logfile)) + sleep(1) + + def tearDown(self): +@@ -90,7 +91,7 @@ class UidGidTest(unittest.TestCase): + + os.chown(self.logfile, NOBODY_UID, NOBODY_GID) + +- os.system("python tests/daemon_uid_gid.py %s %s" % (self.pidfile, self.logfile)) ++ os.system("%s tests/daemon_uid_gid.py %s %s" % (sys.executable, self.pidfile, self.logfile)) + sleep(1) + + with open(self.logfile, "r") as f: +@@ -104,7 +105,7 @@ class UidGidTest(unittest.TestCase): + + os.chown(self.pidfile, NOBODY_UID, NOBODY_GID) + +- os.system("python tests/daemon_uid_gid_action.py %s %s" % (self.pidfile, self.logfile)) ++ os.system("%s tests/daemon_uid_gid_action.py %s %s" % (sys.executable, self.pidfile, self.logfile)) + sleep(1) + + with open(self.logfile, "r") as f: +@@ -120,7 +121,7 @@ Stopping daemon. + """ + self.pidfile = mkstemp()[1] + self.logfile = mkstemp()[1] +- os.system("python tests/daemon_privileged_action.py %s %s" % (self.pidfile, self.logfile)) ++ os.system("%s tests/daemon_privileged_action.py %s %s" % (sys.executable, self.pidfile, self.logfile)) + sleep(.1) + + def tearDown(self): +@@ -139,7 +140,7 @@ class ChdirTest(unittest.TestCase): + self.target = mkstemp()[1] + base, file = split(self.target) + +- os.system("python tests/daemon_chdir.py %s %s %s" % (self.pidfile, base, file)) ++ os.system("%s tests/daemon_chdir.py %s %s %s" % (sys.executable, self.pidfile, base, file)) + sleep(1) + + def tearDown(self): diff --git a/python-daemonize.changes b/python-daemonize.changes index bd7c82b..242c440 100644 --- a/python-daemonize.changes +++ b/python-daemonize.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Apr 30 07:54:44 UTC 2020 - Tomáš Chvátal + +- Add patch to fix test running without python2: + * no-python2.patch + ------------------------------------------------------------------- Thu Mar 7 14:00:13 UTC 2019 - Tomáš Chvátal diff --git a/python-daemonize.spec b/python-daemonize.spec index 5e51d93..03db20e 100644 --- a/python-daemonize.spec +++ b/python-daemonize.spec @@ -1,7 +1,7 @@ # # spec file for package python-daemonize # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -22,9 +22,9 @@ Version: 2.5.0 Release: 0 Summary: Python module to launch code as a daemon process License: MIT -Group: Development/Languages/Python URL: https://github.com/thesharp/daemonize Source: https://github.com/thesharp/daemonize/archive/v%{version}.tar.gz +Patch0: no-python2.patch BuildRequires: %{python_module nose} BuildRequires: %{python_module setuptools} BuildRequires: fdupes @@ -39,6 +39,7 @@ daemonize is a library for writing system daemons in Python. %prep %setup -q -n daemonize-%{version} +%patch0 -p1 %build %python_build From c9a1fc38c16ee6727c26e7964b641678237612d089be97f1a473f0bd306e5191 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Thu, 30 Apr 2020 08:01:45 +0000 Subject: [PATCH 2/2] OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-daemonize?expand=0&rev=11 --- no-python2.patch | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/no-python2.patch b/no-python2.patch index 8d91706..ad1b348 100644 --- a/no-python2.patch +++ b/no-python2.patch @@ -15,7 +15,7 @@ Index: daemonize-2.5.0/tests/test.py def setUp(self): self.pidfile = mkstemp()[1] - os.system("python tests/daemon_sigterm.py %s" % self.pidfile) -+ os.system(sys.executable + " tests/daemon_sigterm.py %s" % self.pidfile) ++ os.system("%s tests/daemon_sigterm.py %s" % (sys.executable, self.pidfile)) sleep(.1) def tearDown(self): @@ -24,7 +24,7 @@ Index: daemonize-2.5.0/tests/test.py self.pidfile = mkstemp()[1] print("First daemonize process started") - os.system("python tests/daemon_sigterm.py %s" % self.pidfile) -+ os.system(sys.executable + " tests/daemon_sigterm.py %s" % self.pidfile) ++ os.system("%s tests/daemon_sigterm.py %s" % (sys.executable, self.pidfile)) sleep(.1) def tearDown(self): @@ -42,7 +42,7 @@ Index: daemonize-2.5.0/tests/test.py self.pidfile = mkstemp()[1] self.logfile = mkstemp()[1] - os.system("python tests/daemon_keep_fds.py %s %s" % (self.pidfile, self.logfile)) -+ os.system(sys.executable + " tests/daemon_keep_fds.py %s %s" % (self.pidfile, self.logfile)) ++ os.system("%s tests/daemon_keep_fds.py %s %s" % (sys.executable, self.pidfile, self.logfile)) sleep(1) def tearDown(self):