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>
9 ;;; This file is part of GNU Guix.
11 ;;; GNU Guix is free software; you can redistribute it and/or modify it
12 ;;; under the terms of the GNU General Public License as published by
13 ;;; the Free Software Foundation; either version 3 of the License, or (at
14 ;;; your option) any later version.
16 ;;; GNU Guix is distributed in the hope that it will be useful, but
17 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;;; GNU General Public License for more details.
21 ;;; You should have received a copy of the GNU General Public License
22 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24 (define-module (gnu packages python-compression)
25 #:use-module ((guix licenses) #:prefix license:)
26 #:use-module (guix utils)
27 #:use-module (guix packages)
28 #:use-module (guix download)
29 #:use-module (guix build-system gnu)
30 #:use-module (guix build-system python)
31 #:use-module (gnu packages)
32 #:use-module (gnu packages compression)
33 #:use-module (gnu packages check)
34 #:use-module (gnu packages maths)
35 #:use-module (gnu packages python)
36 #:use-module (gnu packages python-xyz)
37 #:use-module (gnu packages sphinx))
39 (define-public python-lzo
46 (uri (pypi-uri "python-lzo" version))
49 "0iakqgd51n1cd7r3lpdylm2rgbmd16y74cra9kcapwg84mlf9a4p"))))
50 (build-system python-build-system)
52 `(#:test-target "check"
54 (modify-phases %standard-phases
55 (add-after 'unpack 'patch-setuppy
57 (substitute* "setup.py"
58 (("include_dirs.append\\(.*\\)")
59 (string-append "include_dirs.append('"
60 (assoc-ref %build-inputs "lzo")
66 (home-page "https://github.com/jd-boyd/python-lzo")
67 (synopsis "Python bindings for the LZO data compression library")
69 "Python-LZO provides Python bindings for LZO, i.e. you can access
70 the LZO library from your Python scripts thereby compressing ordinary
72 (license license:gpl2+)))
74 (define-public python2-lzo
75 (package-with-python2 python-lzo))
77 (define-public python-lz4
84 (uri (pypi-uri "lz4" version))
87 "0ghv1xbaq693kgww1x9c22bplz479ls9szjsaa4ig778ls834hm0"))))
88 (build-system python-build-system)
90 `(("python-nose" ,python-nose)
91 ("python-setuptools-scm" ,python-setuptools-scm)))
92 (home-page "https://github.com/python-lz4/python-lz4")
93 (synopsis "LZ4 bindings for Python")
95 "This package provides python bindings for the lz4 compression library
96 by Yann Collet. The project contains bindings for the LZ4 block format and
97 the LZ4 frame format.")
98 (license license:bsd-3)))
100 (define-public python2-lz4
101 (package-with-python2 python-lz4))
103 (define-public python-lzstring
105 (name "python-lzstring")
110 (uri (pypi-uri "lzstring" version))
113 "18ly9pppy2yspxzw7k1b23wk77k7m44rz2g0271bqgqrk3jn3yhs"))))
114 (build-system python-build-system)
116 `(("python-future" ,python-future)))
117 (home-page "https://github.com/gkovacs/lz-string-python")
118 (synopsis "String compression")
119 (description "Lz-string is a string compressor library for Python.")
120 (license license:expat)))
122 (define-public python2-lzstring
123 (package-with-python2 python-lzstring))
125 (define-public bitshuffle
131 (uri (pypi-uri "bitshuffle" version))
134 "1823x61kyax4dc2hjmc1xraskxi1193y8lvxd03vqv029jrj8cjy"))
135 (modules '((guix build utils)))
138 ;; Remove generated Cython files.
139 (delete-file "bitshuffle/h5.c")
140 (delete-file "bitshuffle/ext.c")
142 (build-system python-build-system)
144 `(#:tests? #f ; fail: https://github.com/h5py/h5py/issues/769
146 (modify-phases %standard-phases
147 (add-after 'unpack 'fix-neon-detection
148 ;; Neon is only for aarch64 ATM
149 ;; see: https://github.com/kiyo-masui/bitshuffle/pull/73
151 (substitute* "src/bitshuffle_core.c"
152 (("#define USEARMNEON")
153 "#ifdef __aarch64__\n#define USEARMNEON\n#endif"))
155 (add-after 'unpack 'dont-build-native
157 (substitute* "setup.py"
158 (("'-march=native', ") ""))
161 `(("numpy" ,python-numpy)
162 ("h5py" ,python-h5py)
165 `(("cython" ,python-cython)))
166 (home-page "https://github.com/kiyo-masui/bitshuffle")
167 (synopsis "Filter for improving compression of typed binary data")
168 (description "Bitshuffle is an algorithm that rearranges typed, binary data
169 for improving compression, as well as a python/C package that implements this
170 algorithm within the Numpy framework.")
171 (license license:expat)))
173 (define-public bitshuffle-for-snappy
176 (name "bitshuffle-for-snappy")
177 (build-system gnu-build-system)
179 (substitute-keyword-arguments (package-arguments bitshuffle)
182 `(modify-phases %standard-phases
184 (lambda* (#:key outputs #:allow-other-keys)
185 (with-output-to-file "Makefile"
188 libbitshuffle.so: src/bitshuffle.o src/bitshuffle_core.o src/iochain.o lz4/lz4.o
189 \tgcc -O3 -ffast-math -std=c99 -o $@ -shared -fPIC $^
192 \tgcc -O3 -ffast-math -std=c99 -fPIC -Isrc -Ilz4 -c $< -o $@
195 LIBDIR:=$(PREFIX)/lib
196 INCLUDEDIR:=$(PREFIX)/include
198 install: libbitshuffle.so
199 \tinstall -dm755 $(LIBDIR)
200 \tinstall -dm755 $(INCLUDEDIR)
201 \tinstall -m755 libbitshuffle.so $(LIBDIR)
202 \tinstall -m644 src/bitshuffle.h $(INCLUDEDIR)
203 \tinstall -m644 src/bitshuffle_core.h $(INCLUDEDIR)
204 \tinstall -m644 src/iochain.h $(INCLUDEDIR)
205 \tinstall -m644 lz4/lz4.h $(INCLUDEDIR)
206 " (assoc-ref outputs "out"))))
209 (native-inputs '())))
211 (define-public python-zipp
218 (uri (pypi-uri "zipp" version))
221 "1hsv4zwy1pwnbrr63wjjkpwrmnk36ngbkkqw01bj5hcwh1z3m56a"))))
222 (build-system python-build-system)
224 `(("python-contextlib2" ,python-contextlib2)
225 ("python-pathlib2" ,python-pathlib2)
226 ("python-rst.linker" ,python-rst.linker)))
228 `(("python-setuptools-scm" ,python-setuptools-scm)
229 ("python-sphinx" ,python-sphinx)
230 ("python-unittest2" ,python-unittest2)))
231 (home-page "https://github.com/jaraco/zipp")
233 "Backport of pathlib-compatible object wrapper for zip files")
235 "This package provides a @code{pathlib}-compatible @code{Zipfile} object
236 wrapper. It provides a backport of the @code{Path} object.")
237 (license license:expat)))
239 (define-public python-zstandard
241 (name "python-zstandard")
246 (uri (pypi-uri "zstandard" version))
248 (base32 "0q9msi00s93iqm8vzd839r7yc51gz54z90h5bckqyjdxa6vxijz5"))))
249 (build-system python-build-system)
251 `(("python-hypothesis" ,python-hypothesis)))
252 (home-page "https://github.com/indygreg/python-zstandard")
253 (synopsis "Zstandard bindings for Python")
254 (description "This project provides Python bindings for interfacing with
255 the Zstandard compression library. A C extension and CFFI interface are
257 (license license:bsd-3)))