From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Marusich Subject: Re: Patches to add s3cmd and python-magic Date: Wed, 30 Mar 2016 03:03:18 -0700 Message-ID: <87r3esmgex.fsf@gmail.com> References: <87io071dqo.fsf@gmail.com> <20160328223542.5c66e67e@scratchpost.org> <878u11rgib.fsf@gmail.com> <87wpolpzq7.fsf@gmail.com> <87k2kkgz1t.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50104) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1alCyH-0005MT-BF for guix-devel@gnu.org; Wed, 30 Mar 2016 06:03:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1alCyD-0003fD-CD for guix-devel@gnu.org; Wed, 30 Mar 2016 06:03:29 -0400 In-Reply-To: <87k2kkgz1t.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Wed, 30 Mar 2016 10:17:18 +0200") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Ludovic =?utf-8?Q?Court=C3=A8s?= Cc: guix-devel@gnu.org --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable 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. =2D-=20 Chris --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: attachment; filename=0001-gnu-Add-python-magic.patch Content-Transfer-Encoding: quoted-printable From=20dfdaa5de44cf713bda0a5d907cbcc3ee986aa3f5 Mon Sep 17 00:00:00 2001 From: Chris Marusich 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. =2D-- 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 =2D-- a/gnu/packages/python.scm +++ b/gnu/packages/python.scm @@ -16,7 +16,7 @@ ;;; Copyright =C2=A9 2015, 2016 Erik Edrosa ;;; Copyright =C2=A9 2015, 2016 Efraim Flashner ;;; Copyright =C2=A9 2015 Kyle Meyer =2D;;; Copyright =C2=A9 2015 Chris Marusich +;;; Copyright =C2=A9 2015, 2016 Chris Marusich ;;; Copyright =C2=A9 2016 Danny Milosavljevic ;;; ;;; This file is part of GNU Guix. @@ -6056,7 +6056,10 @@ Python's @code{ctypes} foreign function interface (F= FI).") #t)))))) (inputs `(("file" ,file))) (self-native-input? #f) =2D (synopsis "Python bindings to the libmagic file type guesser"))) + (synopsis "Python bindings to the libmagic file type guesser. Note th= at +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."))) =20 (define-public python2-file (package-with-python2 python-file)) @@ -8490,3 +8493,63 @@ is made as zipfile like as possible.") =20 (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)) =2D-=20 2.7.3 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0002-gnu-Add-python2-s3cmd.patch Content-Transfer-Encoding: quoted-printable From=209414eb426187e7b54332c63f6f674c2d0c233352 Mon Sep 17 00:00:00 2001 From: Chris Marusich 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. =2D-- 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 =2D-- a/gnu/packages/python.scm +++ b/gnu/packages/python.scm @@ -8553,3 +8553,42 @@ the same purpose: to provide Python bindings for lib= magic.") =20 (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+))) =2D-=20 2.7.3 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0003-doc-Clarify-how-to-use-the-python-parameter.patch Content-Transfer-Encoding: quoted-printable From=20d28dcefc22c9d7a296b2b949cc8cb81ac3e9b2b0 Mon Sep 17 00:00:00 2001 From: Chris Marusich 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. =2D-- 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 =2D-- a/doc/guix.texi +++ b/doc/guix.texi @@ -2854,8 +2854,11 @@ For packages that install stand-alone Python program= s 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. =20 =2DWhich Python package is used can be specified with the @code{#:python} =2Dparameter. +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 =20 @defvr {Scheme Variable} perl-build-system =2D-=20 2.7.3 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJW+6RpAAoJEN1AmhXYIkadBIkP/iTsmGnf6oYECrdTdKmqzd4S vgvpNlIXkwPAMum9nryPrMrmRWz73i7VRVznXK753Q8kdd2Wi26GS6AFK7ybcatZ NVbld/fcD+eCFJ2IsHR2KCFmWaWzCWvpuuVXWnMivtf6ZJkGRLOg1dVun91d7T9O 36bdjkQtbrY9LvgKSqcNAdLlrunizz3uAbCdC21Ab31j3p5DW5q4D4osiQv2pFM6 S6VHbYRkDEKmR2zd3L9EFart3awEmWxFOi+U1hEalZr0EvNHcu7CYQckdQWDkQAd spgQt/FfPpxHQ7dr7Zmh026WWGi2t3w4mjl7l28H6+Zp0pkSDwza2ONrqIdMkkmU 4v6A0c+py2K7nZ0BOd2bepHJTb9Fx8qQRgfmufLTT8YsXzM6tOZ3p0GIwjgnqrzw gdKnaXn3J0Sd/EvRxbXl9voU246nIhXQmFMFg5sbOyb+12D/OPVbp7OljWGpMmz2 eJJNqS5gUlHJ3TjtC4MP28MQPnWcQV9DCWixeAU20/r6ALSbQzdl4wfqHt7aLJSo 9xuMJfXpK8QCO7KArWtCw6YoFOAUrU48l7iuWkKAmyEEQXf3zdduT/c974stNRf4 wHupBGXY2zouJrbgTW1PLxTQT6xxOJTQwsN2b4uhXdM+Cbmue4IcBnj1c4NGQbsB TCO90VKhBQ/c5uvzqOYR =9G7E -----END PGP SIGNATURE----- --==-=-=--