gnu: python-magic: Update to 0.4.22.

* gnu/packages/python-xyz.scm (python-magic): Update to 0.4.22.
[source]: Switch to GIT-FETCH.
[arguments]: Remove #:tests?.  Adjust substitution and override check phase.
Remove obsolete phase.
[native-inputs]: Add WHICH.
This commit is contained in:
Marius Bakke 2021-05-22 21:51:19 +02:00
parent 62f534b742
commit 425df5b081
No known key found for this signature in database
GPG key ID: A2A06DF2A33A54FA

View file

@ -13690,31 +13690,19 @@ is made as zipfile like as possible.")
(define-public python-magic (define-public python-magic
(package (package
(name "python-magic") (name "python-magic")
(version "0.4.15") (version "0.4.22")
(home-page "https://github.com/ahupp/python-magic")
(source (source
(origin (origin
(method url-fetch) (method git-fetch)
(uri (pypi-uri "python-magic" version)) (uri (git-reference (url home-page) (commit version)))
(file-name (git-file-name name version))
(sha256 (sha256
(base32 (base32
"1mgwig9pnzgkf86q9ji9pnc99bngms15lfszq5rgqb9db07mqxpk")) "0zbdjr5shijs0jayz7gycpx0kn6v2bh83dpanyajk2vmy47jvbd6"))))
(file-name (string-append name "-" version "-checkout"))))
(build-system python-build-system) (build-system python-build-system)
(arguments (arguments
;; The tests are unreliable, so don't run them. The tests fail '(#:phases (modify-phases %standard-phases
;; 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 ;; Replace a specific method call with a hard-coded
;; path to the necessary libmagic.so file in the ;; path to the necessary libmagic.so file in the
;; store. If we don't do this, then the method call ;; store. If we don't do this, then the method call
@ -13724,24 +13712,22 @@ is made as zipfile like as possible.")
(add-before 'build 'hard-code-path-to-libmagic (add-before 'build 'hard-code-path-to-libmagic
(lambda* (#:key inputs #:allow-other-keys) (lambda* (#:key inputs #:allow-other-keys)
(let ((file (assoc-ref inputs "file"))) (let ((file (assoc-ref inputs "file")))
(substitute* "magic.py" (substitute* "magic/loader.py"
(("ctypes.util.find_library\\('magic'\\)") (("ctypes\\.util\\.find_library\\('magic'\\)")
(string-append "'" file "/lib/libmagic.so'"))) (string-append "'" file "/lib/libmagic.so'"))))))
#t))) (replace 'check
(add-before 'install 'disable-egg-compression (lambda* (#:key tests? #:allow-other-keys)
(lambda _ ;; The test suite mandates this variable.
(let ((port (open-file "setup.cfg" "a"))) (setenv "LC_ALL" "en_US.UTF-8")
(display "\n[easy_install]\nzip_ok = 0\n" (if tests?
port) (invoke "python" "./test/test.py")
(close-port port) (format #t "test suite not run~%")))))))
#t)))))) (native-inputs
`(("which" ,which)))
(inputs (inputs
;; python-magic needs to be able to find libmagic.so. ;; python-magic needs to be able to find libmagic.so.
`(("file" ,file))) `(("file" ,file)))
(home-page (synopsis "File type identification using libmagic")
"https://github.com/ahupp/python-magic")
(synopsis
"File type identification using libmagic")
(description (description
"This module uses ctypes to access the libmagic file type "This module uses ctypes to access the libmagic file type
identification library. It makes use of the local magic database and identification library. It makes use of the local magic database and