diff options
author | Leo Famulari <leo@famulari.name> | 2016-10-17 20:12:32 -0400 |
---|---|---|
committer | Leo Famulari <leo@famulari.name> | 2016-10-19 14:36:51 -0400 |
commit | 7ffa5d4a2da7041712c9b6485923f2c3ee455f82 (patch) | |
tree | 2547b721a0811e37af131b1d4a76add0456346d9 | |
parent | 00bf74be0578fda2cd662ee6dd75ee18c9112f48 (diff) | |
download | guix-7ffa5d4a2da7041712c9b6485923f2c3ee455f82.tar.gz |
gnu: python-file: Work around "double encoding" bug in file@5.28.
* gnu/packages/patches/python-file-double-encoding-bug.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. * gnu/packages/python.scm (python-file)[source]: Use it. (python2-file)[source]: Use the source of FILE directly, without the patch.
-rw-r--r-- | gnu/local.mk | 1 | ||||
-rw-r--r-- | gnu/packages/patches/python-file-double-encoding-bug.patch | 50 | ||||
-rw-r--r-- | gnu/packages/python.scm | 5 |
3 files changed, 56 insertions, 0 deletions
diff --git a/gnu/local.mk b/gnu/local.mk index cda33e1fb3..df86b94e86 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -780,6 +780,7 @@ dist_patch_DATA = \ %D%/packages/patches/python-3.5-fix-tests.patch \ %D%/packages/patches/python-dendropy-exclude-failing-tests.patch \ %D%/packages/patches/python-django-fix-testcase.patch \ + %D%/packages/patches/python-file-double-encoding-bug.patch \ %D%/packages/patches/python-fix-tests.patch \ %D%/packages/patches/python-ipython-inputhook-ctype.patch \ %D%/packages/patches/python-rarfile-fix-tests.patch \ diff --git a/gnu/packages/patches/python-file-double-encoding-bug.patch b/gnu/packages/patches/python-file-double-encoding-bug.patch new file mode 100644 index 0000000000..bbe825c36a --- /dev/null +++ b/gnu/packages/patches/python-file-double-encoding-bug.patch @@ -0,0 +1,50 @@ +Fix bug that breaks file's Python bindings when using Python 3. This patch +should not be applied when using Python 2. + +Copied from upstream source repository: + +https://github.com/file/file/commit/73e043d2a986234b187a00ed0c8d1f7bf83df372 + +From 73e043d2a986234b187a00ed0c8d1f7bf83df372 Mon Sep 17 00:00:00 2001 +From: Christos Zoulas <christos@zoulas.com> +Date: Tue, 28 Jun 2016 17:10:22 +0000 +Subject: [PATCH] PR/562: Reiner Herrmann: Avoid double encoding with python3 + +--- + python/magic.py | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/python/magic.py b/python/magic.py +index c48f7d5..b0f7a17 100644 +--- a/python/magic.py ++++ b/python/magic.py +@@ -134,7 +134,7 @@ class Magic(object): + if isinstance(r, str): + return r + else: +- return str(r).encode('utf-8') ++ return str(r, 'utf-8') + + def descriptor(self, fd): + """ +@@ -152,7 +152,7 @@ class Magic(object): + if isinstance(r, str): + return r + else: +- return str(r).encode('utf-8') ++ return str(r, 'utf-8') + + def error(self): + """ +@@ -163,7 +163,7 @@ class Magic(object): + if isinstance(e, str): + return e + else: +- return str(e).encode('utf-8') ++ return str(e, 'utf-8') + + def setflags(self, flags): + """ +-- +2.10.1 + diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm index f91747903f..559bdc69f0 100644 --- a/gnu/packages/python.scm +++ b/gnu/packages/python.scm @@ -6459,6 +6459,10 @@ Python's @code{ctypes} foreign function interface (FFI).") (package (inherit file) (name "python-file") + (source (origin + (inherit (package-source file)) + ;; This patch should not be applied to python2-file. + (patches (search-patches "python-file-double-encoding-bug.patch")))) (build-system python-build-system) (arguments '(#:tests? #f ;no tests @@ -6487,6 +6491,7 @@ serve the same purpose: provide Python bindings for libmagic.") (let ((base (package-with-python2 (strip-python2-variant python-file)))) (package (inherit base) + (source (package-source file)) (native-inputs `(("python2-setuptools" ,python2-setuptools) ,@(package-native-inputs base)))))) |