1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
3 ;;; Copyright © 2017, 2019 Ricardo Wurmus <rekado@elephly.net>
4 ;;; Copyright © 2017 ng0 <ng0@n0.is>
5 ;;; Copyright © 2017 Julien Lepiller <julien@lepiller.eu>
6 ;;; Copyright © 2018, 2019 Efraim Flashner <efraim@flashner.co.il>
7 ;;; Copyright © 2020 Nicolas Goaziou <mail@nicolasgoaziou.fr>
8 ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
10 ;;; This file is part of GNU Guix.
12 ;;; GNU Guix is free software; you can redistribute it and/or modify it
13 ;;; under the terms of the GNU General Public License as published by
14 ;;; the Free Software Foundation; either version 3 of the License, or (at
15 ;;; your option) any later version.
17 ;;; GNU Guix is distributed in the hope that it will be useful, but
18 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;;; GNU General Public License for more details.
22 ;;; You should have received a copy of the GNU General Public License
23 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
25 (define-module (gnu packages python-compression)
26 #:use-module ((guix licenses) #:prefix license:)
27 #:use-module (guix utils)
28 #:use-module (guix packages)
29 #:use-module (guix download)
30 #:use-module (guix build-system gnu)
31 #:use-module (guix build-system python)
32 #:use-module (gnu packages)
33 #:use-module (gnu packages compression)
34 #:use-module (gnu packages check)
35 #:use-module (gnu packages maths)
36 #:use-module (gnu packages pkg-config)
37 #:use-module (gnu packages python)
38 #:use-module (gnu packages python-xyz)
39 #:use-module (gnu packages sphinx))
41 (define-public python-lzo
48 (uri (pypi-uri "python-lzo" version))
51 "0iakqgd51n1cd7r3lpdylm2rgbmd16y74cra9kcapwg84mlf9a4p"))))
52 (build-system python-build-system)
54 `(#:test-target "check"
56 (modify-phases %standard-phases
57 (add-after 'unpack 'patch-setuppy
59 (substitute* "setup.py"
60 (("include_dirs.append\\(.*\\)")
61 (string-append "include_dirs.append('"
62 (assoc-ref %build-inputs "lzo")
68 (home-page "https://github.com/jd-boyd/python-lzo")
69 (synopsis "Python bindings for the LZO data compression library")
71 "Python-LZO provides Python bindings for LZO, i.e. you can access
72 the LZO library from your Python scripts thereby compressing ordinary
74 (license license:gpl2+)))
76 (define-public python2-lzo
77 (package-with-python2 python-lzo))
79 (define-public python-lz4
86 (uri (pypi-uri "lz4" version))
89 "0ghv1xbaq693kgww1x9c22bplz479ls9szjsaa4ig778ls834hm0"))
90 (modules '((guix build utils)))
93 ;; Remove bundled copy of lz4.
94 (delete-file-recursively "lz4libs")
96 (build-system python-build-system)
98 `(("pkg-config" ,pkg-config)
99 ("python-nose" ,python-nose)
100 ("python-setuptools-scm" ,python-setuptools-scm)))
103 (home-page "https://github.com/python-lz4/python-lz4")
104 (synopsis "LZ4 bindings for Python")
106 "This package provides python bindings for the lz4 compression library
107 by Yann Collet. The project contains bindings for the LZ4 block format and
108 the LZ4 frame format.")
109 (license license:bsd-3)))
111 (define-public python2-lz4
112 (package-with-python2 python-lz4))
114 (define-public python-lzstring
116 (name "python-lzstring")
121 (uri (pypi-uri "lzstring" version))
124 "18ly9pppy2yspxzw7k1b23wk77k7m44rz2g0271bqgqrk3jn3yhs"))))
125 (build-system python-build-system)
127 `(("python-future" ,python-future)))
128 (home-page "https://github.com/gkovacs/lz-string-python")
129 (synopsis "String compression")
130 (description "Lz-string is a string compressor library for Python.")
131 (license license:expat)))
133 (define-public python2-lzstring
134 (package-with-python2 python-lzstring))
136 (define-public bitshuffle
142 (uri (pypi-uri "bitshuffle" version))
145 "1823x61kyax4dc2hjmc1xraskxi1193y8lvxd03vqv029jrj8cjy"))
146 (modules '((guix build utils)))
149 ;; Remove generated Cython files.
150 (delete-file "bitshuffle/h5.c")
151 (delete-file "bitshuffle/ext.c")
153 (build-system python-build-system)
155 `(#:tests? #f ; fail: https://github.com/h5py/h5py/issues/769
157 (modify-phases %standard-phases
158 (add-after 'unpack 'fix-neon-detection
159 ;; Neon is only for aarch64 ATM
160 ;; see: https://github.com/kiyo-masui/bitshuffle/pull/73
162 (substitute* "src/bitshuffle_core.c"
163 (("#define USEARMNEON")
164 "#ifdef __aarch64__\n#define USEARMNEON\n#endif"))
166 (add-after 'unpack 'dont-build-native
168 (substitute* "setup.py"
169 (("'-march=native', ") ""))
172 `(("numpy" ,python-numpy)
173 ("h5py" ,python-h5py)
176 `(("cython" ,python-cython)))
177 (home-page "https://github.com/kiyo-masui/bitshuffle")
178 (synopsis "Filter for improving compression of typed binary data")
179 (description "Bitshuffle is an algorithm that rearranges typed, binary data
180 for improving compression, as well as a python/C package that implements this
181 algorithm within the Numpy framework.")
182 (license license:expat)))
184 (define-public bitshuffle-for-snappy
187 (name "bitshuffle-for-snappy")
188 (build-system gnu-build-system)
190 (substitute-keyword-arguments (package-arguments bitshuffle)
193 `(modify-phases %standard-phases
195 (lambda* (#:key outputs #:allow-other-keys)
196 (with-output-to-file "Makefile"
199 libbitshuffle.so: src/bitshuffle.o src/bitshuffle_core.o src/iochain.o lz4/lz4.o
200 \tgcc -O3 -ffast-math -std=c99 -o $@ -shared -fPIC $^
203 \tgcc -O3 -ffast-math -std=c99 -fPIC -Isrc -Ilz4 -c $< -o $@
206 LIBDIR:=$(PREFIX)/lib
207 INCLUDEDIR:=$(PREFIX)/include
209 install: libbitshuffle.so
210 \tinstall -dm755 $(LIBDIR)
211 \tinstall -dm755 $(INCLUDEDIR)
212 \tinstall -m755 libbitshuffle.so $(LIBDIR)
213 \tinstall -m644 src/bitshuffle.h $(INCLUDEDIR)
214 \tinstall -m644 src/bitshuffle_core.h $(INCLUDEDIR)
215 \tinstall -m644 src/iochain.h $(INCLUDEDIR)
216 \tinstall -m644 lz4/lz4.h $(INCLUDEDIR)
217 " (assoc-ref outputs "out"))))
220 (native-inputs '())))
222 (define-public python-zipp
229 (uri (pypi-uri "zipp" version))
232 "0v3qayhqv7vyzydpydwcp51bqciw8p2ajddw68x5k8zppc0vx3yk"))))
233 (build-system python-build-system)
235 `(("python-more-itertools" ,python-more-itertools)))
237 `(("python-setuptools-scm" ,python-setuptools-scm)))
238 (home-page "https://github.com/jaraco/zipp")
240 "Backport of pathlib-compatible object wrapper for zip files")
242 "This package provides a @code{pathlib}-compatible @code{Zipfile} object
243 wrapper. It provides a backport of the @code{Path} object.")
244 (properties `((python2-variant . ,(delay python2-zipp))))
245 (license license:expat)))
247 (define-public python2-zipp
248 (let ((base (package-with-python2 (strip-python2-variant python-zipp))))
252 `(("python-contextlib2" ,python2-contextlib2)
253 ("python-pathlib2" ,python2-pathlib2)
254 ("python-unittest2" ,python2-unittest2)
255 ,@(package-native-inputs base))))))
257 (define-public python-zstandard
259 (name "python-zstandard")
264 (uri (pypi-uri "zstandard" version))
266 (base32 "0q9msi00s93iqm8vzd839r7yc51gz54z90h5bckqyjdxa6vxijz5"))))
267 (build-system python-build-system)
269 `(("python-hypothesis" ,python-hypothesis)))
270 (home-page "https://github.com/indygreg/python-zstandard")
271 (synopsis "Zstandard bindings for Python")
272 (description "This project provides Python bindings for interfacing with
273 the Zstandard compression library. A C extension and CFFI interface are
275 (license license:bsd-3)))