summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2021-12-21 00:03:46 -0500
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2022-01-10 11:44:43 -0500
commitb4e18112effaa6724fe69f0e8b734da3292b8292 (patch)
tree8b54406cba230f221028e8b334f92f5b8178a7c8 /gnu
parent53d7e92e6836adc0493bad4dc5347be71749f58e (diff)
downloadguix-b4e18112effaa6724fe69f0e8b734da3292b8292.tar.gz
gnu: Add python-zopfli.
* gnu/packages/python-compression.scm (python-zopfli): New variable.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/python-compression.scm33
1 files changed, 33 insertions, 0 deletions
diff --git a/gnu/packages/python-compression.scm b/gnu/packages/python-compression.scm
index afb2caf13b..e7f008e112 100644
--- a/gnu/packages/python-compression.scm
+++ b/gnu/packages/python-compression.scm
@@ -28,6 +28,7 @@
   #:use-module (guix utils)
   #:use-module (guix packages)
   #:use-module (guix download)
+  #:use-module (guix gexp)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system python)
   #:use-module (gnu packages)
@@ -416,6 +417,38 @@ wrapper.  It provides a backport of the @code{Path} object.")
     (native-inputs
      `(("python-setuptools-scm" ,python2-setuptools-scm))))))
 
+(define-public python-zopfli
+  (package
+    (name "python-zopfli")
+    (version "0.1.9")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "zopfli" version ".zip"))
+       (sha256
+        (base32 "0yqdwvlpbvhhri0qmzag076ddi0sv43qjlk17l0siylfib03rpkq"))))
+    (build-system python-build-system)
+    (arguments
+     (list
+      #:phases #~(modify-phases %standard-phases
+                   (add-after 'unpack 'use-system-zopfli
+                     (lambda _
+                       (setenv "USE_SYSTEM_ZOPFLI" "1")))
+                   (add-before 'build 'set-version
+                     (lambda _
+                       (setenv "SETUPTOOLS_SCM_PRETEND_VERSION" #$version)))
+                   (replace 'check
+                     (lambda* (#:key tests? #:allow-other-keys)
+                       (when tests?
+                         (invoke "python" "tests/tests.py" "-v")))))))
+    (native-inputs (list unzip python-setuptools-scm))
+    (inputs (list zopfli))
+    (home-page "https://github.com/fonttools/py-zopfli")
+    (synopsis "Python bindings for Zopfli")
+    (description "@code{pyzopfli} is a straight forward wrapper around the
+@code{ZlibCompress} method of the the @code{zopfli} library.")
+    (license license:asl2.0)))
+
 (define-public python-zstandard
   (package
     (name "python-zstandard")