Hi Ludo,

Thank you for the thoughtful response.  I've updated the s3cmd
description per your suggestions.  Please let me know if any additional
changes are needed.

I've also attached one more small patch which adds some information that
I felt was missing from the Manual regarding the python-build-system.
Since it's small and relevant, it seemed efficient to include it here.

-- 
Chris
From dfdaa5de44cf713bda0a5d907cbcc3ee986aa3f5 Mon Sep 17 00:00:00 2001
From: Chris Marusich <cmmarus...@gmail.com>
Date: Sun, 27 Mar 2016 19:10:48 -0700
Subject: [PATCH 1/3] gnu: Add python-magic.

* gnu/packages/python.scm (python-magic, python2-magic): New variables.
---
 gnu/packages/python.scm | 67 +++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 65 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 88aef9d..f2ef901 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -16,7 +16,7 @@
 ;;; Copyright © 2015, 2016 Erik Edrosa <erik.edr...@gmail.com>
 ;;; Copyright © 2015, 2016 Efraim Flashner <efr...@flashner.co.il>
 ;;; Copyright © 2015 Kyle Meyer <k...@kyleam.com>
-;;; Copyright © 2015 Chris Marusich <cmmarus...@gmail.com>
+;;; Copyright © 2015, 2016 Chris Marusich <cmmarus...@gmail.com>
 ;;; Copyright © 2016 Danny Milosavljevic <danny...@scratchpost.org>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -6056,7 +6056,10 @@ Python's @code{ctypes} foreign function interface (FFI).")
                         #t))))))
     (inputs `(("file" ,file)))
     (self-native-input? #f)
-    (synopsis "Python bindings to the libmagic file type guesser")))
+    (synopsis "Python bindings to the libmagic file type guesser.  Note that
+this module and the python-magic module both provide a \"magic.py\" file;
+these two modules, which are different and were developed separately, both
+serve the same purpose: provide Python bindings for libmagic.")))
 
 (define-public python2-file
   (package-with-python2 python-file))
@@ -8490,3 +8493,63 @@ is made as zipfile like as possible.")
 
 (define-public python2-rarfile
   (package-with-python2 python-rarfile))
+
+(define-public python-magic
+  (package
+    (name "python-magic")
+    (version "0.4.3")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://github.com/ahupp/python-magic/archive/";
+                           version ".tar.gz"))
+       (sha256
+        (base32
+         "17bgy92i7sb021f2s4mw1dcvpm6p1mi9jihridwy1pyn8mzvpjgk"))))
+    (build-system python-build-system)
+    (arguments
+     ;; The tests are unreliable, so don't run them.  The tests fail
+     ;; under Python3 because they were written for Python2 and
+     ;; contain import statements that do not work in Python3.  One of
+     ;; the tests fails under Python2 because its assertions are
+     ;; overly stringent; it relies on comparing output strings which
+     ;; are brittle and can change depending on the version of
+     ;; libmagic being used and the system on which the test is
+     ;; running.  In my case, under GuixSD 0.10.0, only one test
+     ;; failed, and it seems to have failed only because the version
+     ;; of libmagic that is packaged in Guix outputs a slightly
+     ;; different (but not wrong) string than the one that the test
+     ;; expected.
+     '(#:tests? #f
+       #:phases (modify-phases %standard-phases
+         ;; Replace a specific method call with a hard-coded
+         ;; path to the necessary libmagic.so file in the
+         ;; store.  If we don't do this, then the method call
+         ;; will fail to find the libmagic.so file, which in
+         ;; turn will cause any application using
+         ;; python-magic to fail.
+         (add-before 'build 'hard-code-path-to-libmagic
+           (lambda* (#:key inputs #:allow-other-keys)
+             (let ((file (assoc-ref inputs "file")))
+               (substitute* "magic.py"
+                 (("ctypes.util.find_library\\('magic'\\)")
+                  (string-append "'" file "/lib/libmagic.so'")))
+           #t))))))
+    (native-inputs
+     `(("python-setuptools" ,python-setuptools)))
+    (inputs
+     ;; python-magic needs to be able to find libmagic.so.
+     `(("file" ,file)))
+    (home-page "https://github.com/ahupp/python-magic";)
+    (synopsis "File type identification using libmagic")
+    (description
+     "This module uses ctypes to access the libmagic file type
+identification library.  It makes use of the local magic database and
+supports both textual and MIME-type output.  Note that this module and
+the python-file module both provide a \"magic.py\" file; these two
+modules, which are different and were developed separately, both serve
+the same purpose: to provide Python bindings for libmagic.")
+    (license license:expat)))
+
+(define-public python2-magic
+  (package-with-python2 python-magic))
-- 
2.7.3

From 9414eb426187e7b54332c63f6f674c2d0c233352 Mon Sep 17 00:00:00 2001
From: Chris Marusich <cmmarus...@gmail.com>
Date: Sun, 27 Mar 2016 19:28:37 -0700
Subject: [PATCH 2/3] gnu: Add python2-s3cmd.

* gnu/packages/python.scm (python2-s3cmd): New variable.
---
 gnu/packages/python.scm | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index f2ef901..4e7a3fe 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -8553,3 +8553,42 @@ the same purpose: to provide Python bindings for libmagic.")
 
 (define-public python2-magic
   (package-with-python2 python-magic))
+
+(define-public python2-s3cmd
+  (package
+    (name "python2-s3cmd")
+    (version "1.6.1")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (string-append "mirror://sourceforge/s3tools/"
+                            "s3cmd-" version ".tar.gz"))
+        (sha256
+          (base32
+            "0ki1rzhm5icvi9ry5jswi4b22yqwyj0d2wsqsgilwx6qhi7pjxa6"))))
+    (build-system python-build-system)
+    (arguments
+     ;; s3cmd is written for python2 only and contains no tests.
+     `(#:python ,python-2
+       #:tests? #f))
+    (native-inputs
+     `(("python2-setuptools" ,python2-setuptools)))
+    (inputs
+     `(("python2-dateutil" ,python2-dateutil)
+       ;; The python-file package also provides a magic.py module.
+       ;; This is an unfortunate state of affairs; however, s3cmd
+       ;; fails to install if it cannot find specifically the
+       ;; python-magic package.  Thus we include it, instead of using
+       ;; python-file.  Ironically, s3cmd sometimes works better
+       ;; without libmagic bindings at all:
+       ;; https://github.com/s3tools/s3cmd/issues/198
+       ("python2-magic" ,python2-magic)))
+    (home-page "http://s3tools.org/s3cmd";)
+    (synopsis "Command line tool for S3-compatible storage services")
+    (description
+     "S3cmd is a command line tool for uploading, retrieving and managing data
+in storage services that are compatible with the Amazon Simple Storage
+Service (S3) protocol, including S3 itself.  It supports rsync-like backup,
+GnuPG encryption, and more.  It also supports management of Amazon's
+CloudFront content delivery network.")
+    (license gpl2+)))
-- 
2.7.3

From d28dcefc22c9d7a296b2b949cc8cb81ac3e9b2b0 Mon Sep 17 00:00:00 2001
From: Chris Marusich <cmmarus...@gmail.com>
Date: Wed, 30 Mar 2016 02:43:16 -0700
Subject: [PATCH 3/3] doc: Clarify how to use the '#:python' parameter.

doc/guix.texi (Build Systems): Clearly distinguish between the package that
provides the Python interpreter for the build and the package that is to be
built.  Also, mention why one might want to use a specific Python version.
---
 doc/guix.texi | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 1a7f188..7a27ab3 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -2854,8 +2854,11 @@ For packages that install stand-alone Python programs under @code{bin/},
 it takes care of wrapping these programs so that their @code{PYTHONPATH}
 environment variable points to all the Python libraries they depend on.
 
-Which Python package is used can be specified with the @code{#:python}
-parameter.
+Which Python package is used to perform the build can be specified with
+the @code{#:python} parameter.  This is a useful way to force a package
+to be built for a specific version of the Python interpreter, which
+might be necessary if the package is only compatible with a single
+interpreter version.
 @end defvr
 
 @defvr {Scheme Variable} perl-build-system
-- 
2.7.3

Attachment: signature.asc
Description: PGP signature

Reply via email to