unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] gnu: Add python-contextlib2
@ 2015-11-18  8:31 Chris Marusich
  2015-11-18  8:46 ` Andreas Enge
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Chris Marusich @ 2015-11-18  8:31 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 916 bytes --]

Hi,

I've packaged contextlib2. This is my first submission, so please let
me know if there is anything that should be different about the
changes I've made. Also, if there's anything odd about the way I've
formatted these patches or this email, please let me know so I can
correct it next time.

In particular, I'm curious to know if it's required to include
python-setuptools as an input. It seems that the Python build system
is including this build dependency by default, so I've omitted it.

I've run guix lint on the packages and verified that they both build
successfully locally.

Chris Marusich (1):
  gnu: Add python-contextlib2

 gnu/packages/patches/python-contextlib2.patch | 51 +++++++++++++++++++++++++++
 gnu/packages/python.scm                       | 24 +++++++++++++
 2 files changed, 75 insertions(+)
 create mode 100644 gnu/packages/patches/python-contextlib2.patch

-- 
2.5.0

Thank you,
Chris

[-- Attachment #2: 0001-gnu-Add-python-contextlib2.patch --]
[-- Type: application/octet-stream, Size: 4368 bytes --]

From 7f6a02d7c025d9ec408edd8301342aa6422d9d02 Mon Sep 17 00:00:00 2001
From: Chris Marusich <cmmarusich@gmail.com>
Date: Mon, 16 Nov 2015 09:28:37 -0800
Subject: [PATCH] gnu: Add python-contextlib2

* gnu/packages/python.scm (python-contextlib2, python2-contextlib2):
  New variables.
---
 gnu/packages/patches/python-contextlib2.patch | 51 +++++++++++++++++++++++++++
 gnu/packages/python.scm                       | 24 +++++++++++++
 2 files changed, 75 insertions(+)
 create mode 100644 gnu/packages/patches/python-contextlib2.patch

diff --git a/gnu/packages/patches/python-contextlib2.patch b/gnu/packages/patches/python-contextlib2.patch
new file mode 100644
index 0000000..343c121
--- /dev/null
+++ b/gnu/packages/patches/python-contextlib2.patch
@@ -0,0 +1,51 @@
+Make it so the test script included in the contextlib2 tarball will be run
+when setup.py is invoked with the "test" target. Succeed if and only if the
+tests pass.
+
+--- a/setup.py
++++ b/setup.py
+@@ -1,5 +1,36 @@
+ #!/usr/bin/env python
++import subprocess
++import sys
++
+ from distutils.core import setup
++from distutils.cmd import Command
++
++
++class TestRunner(Command):
++    description = "run the test script"
++    # distutils requires that user_options be set, but we don't actually need
++    # to create any special options for this command, so we use an empty list.
++    user_options = []
++    def initialize_options(self):
++        # All Command subclasses are required to implement this method,
++        # but we don't actually need to set up any options for this command.
++        pass
++
++    def finalize_options(self):
++        # Same as above.
++        pass
++
++    def run(self):
++        # The absolute path to the executable file for the currently
++        # running Python interpreter is in sys.executable. Let's just
++        # use that to invoke the tests like someone might from the
++        # shell. If the tests fail, this method call will raise an
++        # exception. The exception will not be caught, so it will cause
++        # the current Python interpreter to print a stack trace and exit
++        # with a non-zero exit code. The test output will go to
++        # stdout/stderr regardless of whether the tests succeed or fail.
++        subprocess.check_call([sys.executable, "./test_contextlib2.py", "-v"])
++
+ 
+ # Technically, unittest2 is a dependency to run the tests on 2.6 and 3.1
+ # This file ignores that, since I don't want to depend on distribute
+@@ -10,6 +41,7 @@ setup(
+     version=open('VERSION.txt').read().strip(),
+     py_modules=['contextlib2'],
+     license='PSF License',
++    cmdclass={'test': TestRunner},
+     description='Backports and enhancements for the contextlib module',
+     long_description=open('README.txt').read(),
+     author='Nick Coghlan',
diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 4e54ef9..1b119fa 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -12,6 +12,7 @@
 ;;; Copyright © 2015 Eric Dvorsak <eric@dvorsak.fr>
 ;;; Copyright © 2015 Leo Famulari <leo@famulari.name>
 ;;; Copyright © 2015 Ben Woodcroft <donttrustben@gmail.com>
+;;; Copyright © 2015, Chris Marusich <cmmarusich@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -5895,3 +5896,26 @@ automatically detect a wide range of file encodings.")
 
 (define-public python2-chardet
   (package-with-python2 python-chardet))
+
+(define-public python-contextlib2
+  (package
+    (name "python-contextlib2")
+    (version "0.4.0")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (pypi-uri "contextlib2" version))
+        (sha256
+         (base32 "0cmp131dlh0d0zvw0aza1zd13glvngzk8lb4avks0hm7yxwdr9am"))
+        (patches (list (search-patch "python-contextlib2.patch")))))
+    (build-system python-build-system)
+    (home-page "http://contextlib2.readthedocs.org/")
+    (synopsis "Tools for decorators and context managers")
+    (description "This module is primarily a backport of the Python 3.2 contextlib to
+earlier Python versions.  Like contextlib, it provides utilities for common
+tasks involving decorators and context managers.  It also contains
+additional features that are not part of the standard library.")
+    (license psfl)))
+
+(define-public python2-contextlib2
+  (package-with-python2 python-contextlib2))
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-12-14  8:44 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-18  8:31 [PATCH] gnu: Add python-contextlib2 Chris Marusich
2015-11-18  8:46 ` Andreas Enge
2015-11-18  8:46 ` Chris Marusich
2015-11-18 12:55 ` Ben Woodcroft
2015-11-21 21:28   ` Chris Marusich
2015-11-26 13:44     ` Ludovic Courtès
2015-12-01  8:22       ` Chris Marusich
2015-12-06 21:49         ` Ludovic Courtès
2015-12-08  5:14           ` Chris Marusich
2015-12-13 23:16             ` Ludovic Courtès
2015-12-14  2:15               ` Chris Marusich
2015-12-14  8:44                 ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).