summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorHartmut Goebel <h.goebel@crazy-compilers.com>2016-10-20 09:52:02 +0200
committerHartmut Goebel <h.goebel@crazy-compilers.com>2016-10-20 09:55:19 +0200
commit8ab59181a423542c34170e049e06f1a1377eb202 (patch)
tree98963f5397fc33d51fc09a00ce6d89fcca54e295 /gnu
parent9518fde1a18bedc445f36b07657cef278a0b977b (diff)
downloadguix-8ab59181a423542c34170e049e06f1a1377eb202.tar.gz
gnu: Add python-setproctitle and python2-setproctitle.
* gnu/packages/python.scm (python-setproctitle, python2-setproctitle):
  New variables.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/python.scm59
1 files changed, 59 insertions, 0 deletions
diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 4b0e5b71ce..268dd513e3 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -11088,3 +11088,62 @@ transfers.")
        `(("python2-futures" ,python2-futures)
          ("python2-setuptools" ,python2-setuptools)
          ,@(package-native-inputs base))))))
+
+(define-public python-setproctitle
+(package
+  (name "python-setproctitle")
+  (version "1.1.10")
+  (source
+    (origin
+      (method url-fetch)
+      (uri (pypi-uri "setproctitle" version))
+      (sha256
+        (base32
+          "163kplw9dcrw0lffq1bvli5yws3rngpnvrxrzdw89pbphjjvg0v2"))))
+  (build-system python-build-system)
+  (arguments
+   '(#:phases
+     (modify-phases %standard-phases
+        (add-before 'check 'patch-Makefile
+           ;; Stricly this is only required for the python2 variant.
+           ;; But adding a phase in an inherited package seems to be
+           ;; cumbersum. So we patch even for python3.
+           (lambda _
+             (let ((nose (assoc-ref %build-inputs "python2-nose")))
+               (when nose
+                 (substitute* "Makefile"
+                   (("\\$\\(PYTHON\\) [^ ]which nosetests[^ ] ")
+                    (string-append nose "/bin/nosetests "))))
+               #t)))
+        (replace 'check
+           (lambda _
+             (setenv "PYTHON" (or (which "python3") (which "python")))
+             (setenv "PYCONFIG" (or (which "python3-config")
+                                    (which "python-config")))
+             (setenv "CC" "gcc")
+             ;; No need to extend PYTHONPATH to find the built package, since
+             ;; the Makefile will build anyway
+             (zero? (system* "make" "check")))))))
+  (native-inputs
+   `(("procps" ,procps))) ; required for tests
+  (home-page
+    "https://github.com/dvarrazzo/py-setproctitle")
+  (synopsis
+   "Setproctitle implementation for Python to customize the process title")
+  (description "The library allows a process to change its title (as displayed
+by system tools such as ps and top).
+
+Changing the title is mostly useful in multi-process systems, for
+example when a master process is forked: changing the children's title
+allows to identify the task each process is busy with.  The technique
+is used by PostgreSQL and the OpenSSH Server for example.")
+  (license license:bsd-3)
+  (properties `((python2-variant . ,(delay python2-setproctitle))))))
+
+(define-public python2-setproctitle
+  (let ((base (package-with-python2
+               (strip-python2-variant python-setproctitle))))
+    (package
+      (inherit base)
+      (native-inputs `(("python2-nose" ,python2-nose)
+                       ,@(package-native-inputs base))))))