From faeda754ff318cfa050c110122f66620538990c8 Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Mon, 6 Mar 2017 21:58:19 +0100 Subject: [PATCH] gnu: Add python2-subprocess32. * gnu/packages/python.scm (python2-subprocess32): New variable. * gnu/packages/patches/python2-subprocess32-disable-input-test.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. --- gnu/local.mk | 1 + .../python2-subprocess32-disable-input-test.patch | 18 ++++++++++ gnu/packages/python.scm | 41 ++++++++++++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 gnu/packages/patches/python2-subprocess32-disable-input-test.patch diff --git a/gnu/local.mk b/gnu/local.mk index 9a4dd693b..a2bbefcca 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -870,6 +870,7 @@ dist_patch_DATA = \ %D%/packages/patches/python-pycrypto-CVE-2013-7459.patch \ %D%/packages/patches/python2-pygobject-2-gi-info-type-error-domain.patch \ %D%/packages/patches/python-pygpgme-fix-pinentry-tests.patch \ + %D%/packages/patches/python2-subprocess32-disable-input-test.patch \ %D%/packages/patches/qemu-CVE-2016-10155.patch \ %D%/packages/patches/qemu-CVE-2017-2615.patch \ %D%/packages/patches/qemu-CVE-2017-5525.patch \ diff --git a/gnu/packages/patches/python2-subprocess32-disable-input-test.patch b/gnu/packages/patches/python2-subprocess32-disable-input-test.patch new file mode 100644 index 000000000..05b4eef1b --- /dev/null +++ b/gnu/packages/patches/python2-subprocess32-disable-input-test.patch @@ -0,0 +1,18 @@ +This test tries to send a KeyboardInterrupt, which does +not work in the build environment. + +--- a/test_subprocess32.py 2017-03-06 22:21:49.334045485 +0100 ++++ b/test_subprocess32.py 2017-03-06 22:22:02.490439949 +0100 +@@ -1299,12 +1299,6 @@ + getattr(p, method)(*args) + return p + +- def test_send_signal(self): +- p = self._kill_process('send_signal', signal.SIGINT) +- _, stderr = p.communicate() +- self.assertIn('KeyboardInterrupt', stderr) +- self.assertNotEqual(p.wait(), 0) +- + def test_kill(self): + p = self._kill_process('kill') + _, stderr = p.communicate() diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm index 3c5d0f7e3..d46739be6 100644 --- a/gnu/packages/python.scm +++ b/gnu/packages/python.scm @@ -9040,6 +9040,47 @@ authenticated session objects providing things like keep-alive.") 3.2.3 for use with older versions of Python and PyPy.") (license license:expat))) +(define-public python2-subprocess32 + (package + (name "python2-subprocess32") + (version "3.2.7") + (source (origin + (method url-fetch) + (uri (pypi-uri "subprocess32" version)) + (sha256 + (base32 + "14350dhhlhyz5gqzi3lihn9m6lvskx5mcb20srx1kgsk9i50li8y")) + (patches + (search-patches "python2-subprocess32-disable-input-test.patch")))) + (build-system python-build-system) + (arguments + `(#:python ,python-2 + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'patch-/bin/sh + (lambda _ + (substitute* '("subprocess32.py" + "test_subprocess32.py") + (("/bin/sh") (which "sh"))) + #t)) + (delete 'check) + (add-after 'install 'check + (lambda* (#:key inputs outputs #:allow-other-keys) + ;; For some reason this package fails to import + ;; _posixsubprocess.so when PYTHONPATH is set to the build + ;; directory. Running tests after install is easier. + (add-installed-pythonpath inputs outputs) + (zero? (system* "python" "test_subprocess32.py"))))))) + (home-page "https://github.com/google/python-subprocess32") + (synopsis "Backport of the subprocess module from Python 3.2") + (description + "This is a backport of the @code{subprocess} standard library module +from Python 3.2 and 3.3 for use on Python 2. It includes bugfixes and some +new features. On POSIX systems it is guaranteed to be reliable when used +in threaded applications. It includes timeout support from Python 3.3 but +otherwise matches 3.2’s API.") + (license license:psfl))) + (define-public python2-futures (package (name "python2-futures") -- 2.12.0