all messages for Guix-related lists mirrored at yhetil.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

* Re: [PATCH] gnu: Add python-contextlib2
  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
  2 siblings, 0 replies; 12+ messages in thread
From: Andreas Enge @ 2015-11-18  8:46 UTC (permalink / raw)
  To: Chris Marusich; +Cc: guix-devel

Hello,

and congratulations for your first package!

Upon a quick glance, I have the following comments:

>   gnu: Add python-contextlib2

Please add a "." at the end of the line.

> * 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(+)

You also need to add the patch to gnu-system.am. Then add two lines to the 
commit log explaining the changes to the two other files; you will find
examples in the commit history.

At the top of a patch file, we usually provide a little explanation of why
the patch is needed; if it concerns a problem to be fixed upstream, we
usually report the bug and add a reference to the bug url; if it comes
from another distribution we give the reference.

Did you run "./pre-inst-env guix lint python-contextlib2" etc.? This can
detect potential problems. (I did not try it on your patch, and am just
asking because I tend to forget it myself.)

I let the python gurus comment on the content of the package.

Andreas

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

* Re: [PATCH] gnu: Add python-contextlib2
  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
  2 siblings, 0 replies; 12+ messages in thread
From: Chris Marusich @ 2015-11-18  8:46 UTC (permalink / raw)
  To: guix-devel

Hi,

I'll respond to one of my own questions:

> 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.

Actually, contextlib2 only requires the built-in distutils to build,
which might be why steuptools is not actually necessary. That might be
why the build succeeded in spite of not having setuptools in the
dependency closure.

Thank you,
Chris

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

* Re: [PATCH] gnu: Add python-contextlib2
  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
  2 siblings, 1 reply; 12+ messages in thread
From: Ben Woodcroft @ 2015-11-18 12:55 UTC (permalink / raw)
  To: Chris Marusich, guix-devel@gnu.org

Hi there.

On 18/11/15 18:31, Chris Marusich wrote:
> 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.
If I'm understanding correctly, the sole purpose of the patch is to make 
the tests run. In that case, I think it might be simpler to replace the 
check phase like so?

     (build-system python-build-system)
     (arguments
      `(#:phases
        (modify-phases %standard-phases
          (replace 'check
            (lambda _ (system* "python" "test_contextlib2.py", "-v"))))))

Thanks for the contribution. I second Andreas' welcome.
ben

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

* Re: [PATCH] gnu: Add python-contextlib2
  2015-11-18 12:55 ` Ben Woodcroft
@ 2015-11-21 21:28   ` Chris Marusich
  2015-11-26 13:44     ` Ludovic Courtès
  0 siblings, 1 reply; 12+ messages in thread
From: Chris Marusich @ 2015-11-21 21:28 UTC (permalink / raw)
  To: Ben Woodcroft; +Cc: guix-devel@gnu.org

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

Hi,

Thank you for the feedback, Ben and Andreas! I did not know about the
"modify-phases" procedure. That's very useful. I've attached the
modified patch. I've confirmed for both packages that "guix lint" does
not show any errors, that the build succeeds (and tests are run
successfully), and that installation also succeeds. It turns out that
you need to check the exit code of the system* call; if you don't, the
build will succeed even when the tests fail. So I've added that.

However, there is one curiosity. I've noticed that when I run
"./pre-inst-env guix environment python2-contextlib2", the PYTHONPATH
is configured to allow importation of contextlib2 from the
$profile/lib/python3.4/site-packages directory tree, rather than
$profile/lib/python2.7/site-packages. When I run python in this
environment, I get a Python 2.7 interpreter. When I import
contextlib2, it succeeds, and when I check the module's file location,
I see that it does in fact come from the
$profile/lib/python3.4/site-packages directory tree. This seems odd.
Is this expected behavior? Here's the exact output I see (hopefully my
email client won't mess up the formatting too badly):

[0] marusich@garuda:~/guix
$ ./pre-inst-env guix package --list-installed=context
;;; note: source file /home/marusich/guix/gnu/packages/python.scm
;;;       newer than compiled /home/marusich/guix/gnu/packages/python.go
;;; note: source file /home/marusich/guix/gnu/packages/python.scm
;;;       newer than compiled
/home/marusich/.cache/guile/ccache/2.0-LE-8-2.0/home/marusich/guix/gnu/packages/python.scm.go
python-contextlib2	0.4.0	out	/gnu/store/5k9qn3csi0w32xrjqv50f9ifyjf0bb29-python-contextlib2-0.4.0
python2-contextlib2	0.4.0	out	/gnu/store/msvhvplrir30lbdk5f54x9mxr7pm8qd5-python2-contextlib2-0.4.0
[0] marusich@garuda:~/guix
$ ls /gnu/store/msvhvplrir30lbdk5f54x9mxr7pm8qd5-python2-contextlib2-0.4.0
lib/
[0] marusich@garuda:~/guix
$ ls /gnu/store/msvhvplrir30lbdk5f54x9mxr7pm8qd5-python2-contextlib2-0.4.0/lib/python2.7/site-packages/contextlib2
contextlib2-0.4.0-py2.7.egg-info  contextlib2.py
contextlib2.pyc
[0] marusich@garuda:~/guix
$ ./pre-inst-env guix environment python2-contextlib2
;;; note: source file /home/marusich/guix/gnu/packages/python.scm
;;;       newer than compiled /home/marusich/guix/gnu/packages/python.go
;;; note: source file /home/marusich/guix/gnu/packages/python.scm
;;;       newer than compiled
/home/marusich/.cache/guile/ccache/2.0-LE-8-2.0/home/marusich/guix/gnu/packages/python.scm.go
[0] [env] marusich@garuda:~/guix
$ env | grep PYTHONP
PYTHONPATH=/gnu/store/sf69z6zr57vjgh57a1vsf7kr7bcsg5pj-python-2.7.10/lib/python2.7/site-packages:/home/marusich/.guix-profile/lib/python3.4/site-packages
[0] [env] marusich@garuda:~/guix
$ env | grep PYTHON
PYTHONPATH=/gnu/store/sf69z6zr57vjgh57a1vsf7kr7bcsg5pj-python-2.7.10/lib/python2.7/site-packages:/home/marusich/.guix-profile/lib/python3.4/site-packages
[0] [env] marusich@garuda:~/guix
$

I'm also curious: why does the "(#:phases" part need to be
quasi-quoted with the backtick symbol "`"? I know what quoting and
quasi-quoting are, but I'm not familiar with Scheme records, so it's
possible that this is something obvious that is related to records
which I just haven't learned about yet. I ask because I searched the
manual and could not find any obvious leads, so if you can point me in
the right direction to understand why the quasi-quote is necessary
here, I'd be grateful.

Thank you,
Chris

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

From d7ee2fc4eb93dd170a01592ccc1473268e81806a 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/python.scm | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 4e54ef9..2353ab0 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,31 @@ 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"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (replace 'check
+           (lambda _ (zero?
+                      (system* "python" "test_contextlib2.py", "-v")))))))
+    (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

* Re: [PATCH] gnu: Add python-contextlib2
  2015-11-21 21:28   ` Chris Marusich
@ 2015-11-26 13:44     ` Ludovic Courtès
  2015-12-01  8:22       ` Chris Marusich
  0 siblings, 1 reply; 12+ messages in thread
From: Ludovic Courtès @ 2015-11-26 13:44 UTC (permalink / raw)
  To: Chris Marusich; +Cc: guix-devel@gnu.org

Hi!

Sorry for the delay.

Chris Marusich <cmmarusich@gmail.com> skribis:

> However, there is one curiosity. I've noticed that when I run
> "./pre-inst-env guix environment python2-contextlib2", the PYTHONPATH
> is configured to allow importation of contextlib2 from the
> $profile/lib/python3.4/site-packages directory tree, rather than
> $profile/lib/python2.7/site-packages. When I run python in this
> environment, I get a Python 2.7 interpreter.

The interpreter you get here is probably one that was already in PATH,
because the command above lacks --pure.

If you want to be sure, use:

  ./pre-inst-env guix environment --pure \
        python2-contextlib python-2 -- python

(Even better: --container instead of --pure.)

Can you confirm?

> I'm also curious: why does the "(#:phases" part need to be
> quasi-quoted with the backtick symbol "`"?

The #:phases part specified build code (info "(guix) G-Expressions").
That code is quoted because we don’t want to evaluate it; we merely want
to pass the code itself for future execution in the build environment.

Does that make sense?

Thanks,
Ludo’.

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

* Re: [PATCH] gnu: Add python-contextlib2
  2015-11-26 13:44     ` Ludovic Courtès
@ 2015-12-01  8:22       ` Chris Marusich
  2015-12-06 21:49         ` Ludovic Courtès
  0 siblings, 1 reply; 12+ messages in thread
From: Chris Marusich @ 2015-12-01  8:22 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel@gnu.org

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

Hi Ludo',

Yes, your explanation about the quoting makes sense. Also, it looks like
you were right: the PYTHONPATH leaked from my current environment. Thank
you for your help.

Would you like me to adjust the length of the longest line as mentioned by
Ben, or is my patch good to go as-is?

Thank you,
Chris

On Thu, Nov 26, 2015 at 5:44 AM Ludovic Courtès <ludo@gnu.org> wrote:

> Hi!
>
> Sorry for the delay.
>
> Chris Marusich <cmmarusich@gmail.com> skribis:
>
> > However, there is one curiosity. I've noticed that when I run
> > "./pre-inst-env guix environment python2-contextlib2", the PYTHONPATH
> > is configured to allow importation of contextlib2 from the
> > $profile/lib/python3.4/site-packages directory tree, rather than
> > $profile/lib/python2.7/site-packages. When I run python in this
> > environment, I get a Python 2.7 interpreter.
>
> The interpreter you get here is probably one that was already in PATH,
> because the command above lacks --pure.
>
> If you want to be sure, use:
>
>   ./pre-inst-env guix environment --pure \
>         python2-contextlib python-2 -- python
>
> (Even better: --container instead of --pure.)
>
> Can you confirm?
>
> > I'm also curious: why does the "(#:phases" part need to be
> > quasi-quoted with the backtick symbol "`"?
>
> The #:phases part specified build code (info "(guix) G-Expressions").
> That code is quoted because we don’t want to evaluate it; we merely want
> to pass the code itself for future execution in the build environment.
>
> Does that make sense?
>
> Thanks,
> Ludo’.
>

[-- Attachment #2: Type: text/html, Size: 2136 bytes --]

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

* Re: [PATCH] gnu: Add python-contextlib2
  2015-12-01  8:22       ` Chris Marusich
@ 2015-12-06 21:49         ` Ludovic Courtès
  2015-12-08  5:14           ` Chris Marusich
  0 siblings, 1 reply; 12+ messages in thread
From: Ludovic Courtès @ 2015-12-06 21:49 UTC (permalink / raw)
  To: Chris Marusich; +Cc: guix-devel@gnu.org

Chris Marusich <cmmarusich@gmail.com> skribis:

> Yes, your explanation about the quoting makes sense. Also, it looks like
> you were right: the PYTHONPATH leaked from my current environment. Thank
> you for your help.

You’re welcome!

> Would you like me to adjust the length of the longest line as mentioned by
> Ben, or is my patch good to go as-is?

Yes, could you adjust it and send an updated patch?

I must I was a bit confused, partly due to the reply-on-top, which made
it more difficult for me to see what you were referring to.  Okay, I was
also late for other reasons ;-), but still, I think it’d be great if you
could avoid top-posting.

Thank you!

Ludo’.

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

* Re: [PATCH] gnu: Add python-contextlib2
  2015-12-06 21:49         ` Ludovic Courtès
@ 2015-12-08  5:14           ` Chris Marusich
  2015-12-13 23:16             ` Ludovic Courtès
  0 siblings, 1 reply; 12+ messages in thread
From: Chris Marusich @ 2015-12-08  5:14 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel@gnu.org

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

Hi,

On 12/6/15, Ludovic Courtès <ludo@gnu.org> wrote:
> Yes, could you adjust it and send an updated patch?
>

I've attached the new patch here. I've shortened a few lines,
including the one requested.

In particular, I've shortened every line of the description to 70
columns. Because of that, it looks like the first line of the
description will wind up being significantly shorter than 70 chars.
Are the newlines in the description significant? Or is there some
reformatting that happens when the description is printed to the
terminal, e.g. via "guix package --search=foo"? I'm just curious
because one might find it aesthetically displeasing if the first line
is cut short simply because we had to format to 70 columns the code
where the package description happened to be defined. It's totally
minor, though.

I'm also not sure why my emacs did not automatically wrap the lines to
70 chars in the first place, since I do see that the fill-column
variable was set to 70.  I guess I'll have to look into that, but for
now I was able to wrap it to 70 chars myself.

> I must I was a bit confused, partly due to the reply-on-top, which made
> it more difficult for me to see what you were referring to.  Okay, I was
> also late for other reasons ;-), but still, I think it’d be great if you
> could avoid top-posting.

Thanks for pointing this out; I'll reply on the bottom from now on!

Chris

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

From 4089b10f384b389999576dfc8766c661a5787a4b Mon Sep 17 00:00:00 2001
From: Chris Marusich <cmmarusich@gmail.com>
Date: Mon, 7 Dec 2015 21:07:40 -0800
Subject: [PATCH] gnu: Add python-contextlib2.

* gnu/packages/python.scm (python-contextlib2, python2-contextlib2):
  New variables.
---
 gnu/packages/python.scm | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index d01c1d3..c70fdd0 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -6565,3 +6565,34 @@ of the SSL peer.")
     (arguments `(#:python ,python-2))
     (propagated-inputs
      `(("python2-pyopenssl" ,python2-pyopenssl)))))
+
+(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"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (replace 'check
+           (lambda _ (zero?
+                      (system*
+                       "python" "test_contextlib2.py", "-v")))))))
+    (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

* Re: [PATCH] gnu: Add python-contextlib2
  2015-12-08  5:14           ` Chris Marusich
@ 2015-12-13 23:16             ` Ludovic Courtès
  2015-12-14  2:15               ` Chris Marusich
  0 siblings, 1 reply; 12+ messages in thread
From: Ludovic Courtès @ 2015-12-13 23:16 UTC (permalink / raw)
  To: Chris Marusich; +Cc: guix-devel@gnu.org

Chris Marusich <cmmarusich@gmail.com> skribis:

> On 12/6/15, Ludovic Courtès <ludo@gnu.org> wrote:
>> Yes, could you adjust it and send an updated patch?
>>
>
> I've attached the new patch here. I've shortened a few lines,
> including the one requested.

Great.

> In particular, I've shortened every line of the description to 70
> columns. Because of that, it looks like the first line of the
> description will wind up being significantly shorter than 70 chars.
> Are the newlines in the description significant? Or is there some
> reformatting that happens when the description is printed to the
> terminal, e.g. via "guix package --search=foo"?

Yes, there’s reformatting happening here, so don’t worry.  We normally
wrap at 78 columns, as per .dir-locals.el.

>> I must I was a bit confused, partly due to the reply-on-top, which made
>> it more difficult for me to see what you were referring to.  Okay, I was
>> also late for other reasons ;-), but still, I think it’d be great if you
>> could avoid top-posting.
>
> Thanks for pointing this out; I'll reply on the bottom from now on!

Thanks.  :-)

> From 4089b10f384b389999576dfc8766c661a5787a4b Mon Sep 17 00:00:00 2001
> From: Chris Marusich <cmmarusich@gmail.com>
> Date: Mon, 7 Dec 2015 21:07:40 -0800
> Subject: [PATCH] gnu: Add python-contextlib2.
>
> * gnu/packages/python.scm (python-contextlib2, python2-contextlib2):
>   New variables.

[...]

> +    (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))

IIUC the description it only makes sense for Python 2.x, right?

In that case, could you add an explicit #:python in ‘arguments’ and keep
only the 2.x variant?  I could do that for you if you prefer.

Thanks, and sorry for the delay!

Ludo’.

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

* Re: [PATCH] gnu: Add python-contextlib2
  2015-12-13 23:16             ` Ludovic Courtès
@ 2015-12-14  2:15               ` Chris Marusich
  2015-12-14  8:44                 ` Ludovic Courtès
  0 siblings, 1 reply; 12+ messages in thread
From: Chris Marusich @ 2015-12-14  2:15 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel@gnu.org

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

Thanks for the response. The module is primarily a backport, but it also
contains some features that are not part of the standard library.
Therefore, it is not exactly the same as the Python standard library's
contextlib module, even in Python 3. Since the module names don't collide,
and since I know of at least one project that uses contextlib2 with Python3
[1], I think it'd be good to package it for both Python 2 and Python 3. If
you or anyone else has a strong opinion on this, let's talk about it.

[1] I intend to package vcrpy after I package contextlib2, since the former
uses the latter: https://github.com/kevin1024/vcrpy/blob/master/setup.py

On Sun, Dec 13, 2015, 15:16 Ludovic Courtès <ludo@gnu.org> wrote:

> Chris Marusich <cmmarusich@gmail.com> skribis:
>
> > On 12/6/15, Ludovic Courtès <ludo@gnu.org> wrote:
> >> Yes, could you adjust it and send an updated patch?
> >>
> >
> > I've attached the new patch here. I've shortened a few lines,
> > including the one requested.
>
> Great.
>
> > In particular, I've shortened every line of the description to 70
> > columns. Because of that, it looks like the first line of the
> > description will wind up being significantly shorter than 70 chars.
> > Are the newlines in the description significant? Or is there some
> > reformatting that happens when the description is printed to the
> > terminal, e.g. via "guix package --search=foo"?
>
> Yes, there’s reformatting happening here, so don’t worry.  We normally
> wrap at 78 columns, as per .dir-locals.el.
>
> >> I must I was a bit confused, partly due to the reply-on-top, which made
> >> it more difficult for me to see what you were referring to.  Okay, I was
> >> also late for other reasons ;-), but still, I think it’d be great if you
> >> could avoid top-posting.
> >
> > Thanks for pointing this out; I'll reply on the bottom from now on!
>
> Thanks.  :-)
>
> > From 4089b10f384b389999576dfc8766c661a5787a4b Mon Sep 17 00:00:00 2001
> > From: Chris Marusich <cmmarusich@gmail.com>
> > Date: Mon, 7 Dec 2015 21:07:40 -0800
> > Subject: [PATCH] gnu: Add python-contextlib2.
> >
> > * gnu/packages/python.scm (python-contextlib2, python2-contextlib2):
> >   New variables.
>
> [...]
>
> > +    (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))
>
> IIUC the description it only makes sense for Python 2.x, right?
>
> In that case, could you add an explicit #:python in ‘arguments’ and keep
> only the 2.x variant?  I could do that for you if you prefer.
>
> Thanks, and sorry for the delay!
>
> Ludo’.
>

[-- Attachment #2: Type: text/html, Size: 4040 bytes --]

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

* Re: [PATCH] gnu: Add python-contextlib2
  2015-12-14  2:15               ` Chris Marusich
@ 2015-12-14  8:44                 ` Ludovic Courtès
  0 siblings, 0 replies; 12+ messages in thread
From: Ludovic Courtès @ 2015-12-14  8:44 UTC (permalink / raw)
  To: Chris Marusich; +Cc: guix-devel@gnu.org

Chris Marusich <cmmarusich@gmail.com> skribis:

> Thanks for the response. The module is primarily a backport, but it also
> contains some features that are not part of the standard library.
> Therefore, it is not exactly the same as the Python standard library's
> contextlib module, even in Python 3. Since the module names don't collide,
> and since I know of at least one project that uses contextlib2 with Python3
> [1], I think it'd be good to package it for both Python 2 and Python 3. If
> you or anyone else has a strong opinion on this, let's talk about it.

Makes sense to me.

I’ve pushed the patch after adding a copyright line for you.

Thank you!

Ludo’.

^ permalink raw reply	[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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.