guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: gnu: diffoscope: Update to use python-magic.


From: guix-commits
Subject: branch master updated: gnu: diffoscope: Update to use python-magic.
Date: Fri, 12 Feb 2021 19:15:23 -0500

This is an automated email from the git hooks/post-receive script.

vagrantc pushed a commit to branch master
in repository guix.

The following commit(s) were added to refs/heads/master by this push:
     new d588cc8  gnu: diffoscope: Update to use python-magic.
d588cc8 is described below

commit d588cc8fa96e4a4bce56fac2ba3bbaaeaaed0047
Author: Vagrant Cascadian <vagrant@reproducible-builds.org>
AuthorDate: Fri Feb 12 15:53:45 2021 -0800

    gnu: diffoscope: Update to use python-magic.
    
    Fixes: https://salsa.debian.org/reproducible-builds/diffoscope/-/issues/238
    
    * gnu/packages/patches/diffoscope-revert-to-magic-open.patch: Remove file.
    * gnu/local.mk [dist_patch_DATA]: Update.
    * gnu/packages/diffoscope.scm (diffoscope)[source]: Remove patch.
      [inputs]: Remove python-file.
---
 gnu/local.mk                                       |  1 -
 gnu/packages/diffoscope.scm                        |  5 +-
 .../patches/diffoscope-revert-to-magic-open.patch  | 70 ----------------------
 3 files changed, 1 insertion(+), 75 deletions(-)

diff --git a/gnu/local.mk b/gnu/local.mk
index 0625c6c..ad6e021 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -927,7 +927,6 @@ dist_patch_DATA =                                           
\
   %D%/packages/patches/desmume-gcc6-fixes.patch                        \
   %D%/packages/patches/desmume-gcc7-fixes.patch                        \
   %D%/packages/patches/dfu-programmer-fix-libusb.patch         \
-  %D%/packages/patches/diffoscope-revert-to-magic-open.patch   \
   %D%/packages/patches/diffutils-gets-undeclared.patch         \
   %D%/packages/patches/dkimproxy-add-ipv6-support.patch                \
   %D%/packages/patches/docbook-xsl-nonrecursive-string-subst.patch     \
diff --git a/gnu/packages/diffoscope.scm b/gnu/packages/diffoscope.scm
index a31ac48..feb0324 100644
--- a/gnu/packages/diffoscope.scm
+++ b/gnu/packages/diffoscope.scm
@@ -81,9 +81,7 @@
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "0vc4a38ii6b10af4c7cxfkvj4lk4ihx1xs4q5lshnkyg74gmm21b"))
-              (patches (search-patches
-                        "diffoscope-revert-to-magic-open.patch"))))
+                "0vc4a38ii6b10af4c7cxfkvj4lk4ihx1xs4q5lshnkyg74gmm21b"))))
     (build-system python-build-system)
     (arguments
      `(#:phases (modify-phases %standard-phases
@@ -137,7 +135,6 @@
                         (install-file "doc/diffoscope.1" man)
                         #t))))))
     (inputs `(("rpm" ,rpm)              ;for rpm-python
-              ("python-file" ,python-file)
               ("python-debian" ,python-debian)
               ("python-libarchive-c" ,python-libarchive-c)
               ("python-magic" ,python-magic)
diff --git a/gnu/packages/patches/diffoscope-revert-to-magic-open.patch 
b/gnu/packages/patches/diffoscope-revert-to-magic-open.patch
deleted file mode 100644
index d52b26e..0000000
--- a/gnu/packages/patches/diffoscope-revert-to-magic-open.patch
+++ /dev/null
@@ -1,70 +0,0 @@
-From b658c3a6819ccb9a104b13e973132c66f0965965 Mon Sep 17 00:00:00 2001
-From: Vagrant Cascadian <vagrant@reproducible-builds.org>
-Date: Thu, 11 Feb 2021 17:28:21 -0800
-Subject: [PATCH] Revert "Prefer to use magic.Magic over the magic.open
- compatibility interface. (Closes: reproducible-builds/diffoscope#236)"
-
-This reverts commit c72c30f29ea3760eb4c785644dc7cd4c26833740.
----
- diffoscope/comparators/utils/file.py | 28 ++++++++++++++--------------
- 1 file changed, 14 insertions(+), 14 deletions(-)
-
-diff --git a/diffoscope/comparators/utils/file.py 
b/diffoscope/comparators/utils/file.py
-index fb3b4316..32700f02 100644
---- a/diffoscope/comparators/utils/file.py
-+++ b/diffoscope/comparators/utils/file.py
-@@ -65,37 +65,37 @@ def _run_tests(fold, tests):
- 
- 
- class File(metaclass=abc.ABCMeta):
--    if hasattr(magic, "Magic"):  # use python-magic
-+    if hasattr(magic, "open"):  # use Magic-file-extensions from file
- 
-         @classmethod
-         def guess_file_type(cls, path):
-             if not hasattr(cls, "_mimedb"):
--                cls._mimedb = magic.Magic()
--            return maybe_decode(cls._mimedb.from_file(path))
-+                cls._mimedb = magic.open(magic.NONE)
-+                cls._mimedb.load()
-+            return cls._mimedb.file(
-+                path.encode("utf-8", errors="surrogateescape")
-+            )
- 
-         @classmethod
-         def guess_encoding(cls, path):
-             if not hasattr(cls, "_mimedb_encoding"):
--                cls._mimedb_encoding = magic.Magic(mime_encoding=True)
--            return maybe_decode(cls._mimedb_encoding.from_file(path))
-+                cls._mimedb_encoding = magic.open(magic.MAGIC_MIME_ENCODING)
-+                cls._mimedb_encoding.load()
-+            return cls._mimedb_encoding.file(path)
- 
--    else:  # use Magic-file-extensions from file
-+    else:  # use python-magic
- 
-         @classmethod
-         def guess_file_type(cls, path):
-             if not hasattr(cls, "_mimedb"):
--                cls._mimedb = magic.open(magic.NONE)
--                cls._mimedb.load()
--            return cls._mimedb.file(
--                path.encode("utf-8", errors="surrogateescape")
--            )
-+                cls._mimedb = magic.Magic()
-+            return maybe_decode(cls._mimedb.from_file(path))
- 
-         @classmethod
-         def guess_encoding(cls, path):
-             if not hasattr(cls, "_mimedb_encoding"):
--                cls._mimedb_encoding = magic.open(magic.MAGIC_MIME_ENCODING)
--                cls._mimedb_encoding.load()
--            return cls._mimedb_encoding.file(path)
-+                cls._mimedb_encoding = magic.Magic(mime_encoding=True)
-+            return maybe_decode(cls._mimedb_encoding.from_file(path))
- 
-     def __init__(self, container=None):
-         self._comments = []
--- 
-2.30.0
-



reply via email to

[Prev in Thread] Current Thread [Next in Thread]