1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
3 ;;; Copyright © 2017 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>
8 ;;; This file is part of GNU Guix.
10 ;;; GNU Guix is free software; you can redistribute it and/or modify it
11 ;;; under the terms of the GNU General Public License as published by
12 ;;; the Free Software Foundation; either version 3 of the License, or (at
13 ;;; your option) any later version.
15 ;;; GNU Guix is distributed in the hope that it will be useful, but
16 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;;; GNU General Public License for more details.
20 ;;; You should have received a copy of the GNU General Public License
21 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
23 (define-module (gnu packages python-compression)
24 #:use-module ((guix licenses) #:prefix license:)
25 #:use-module (guix utils)
26 #:use-module (guix packages)
27 #:use-module (guix download)
28 #:use-module (guix build-system gnu)
29 #:use-module (guix build-system python)
30 #:use-module (gnu packages)
31 #:use-module (gnu packages compression)
32 #:use-module (gnu packages check)
33 #:use-module (gnu packages maths)
34 #:use-module (gnu packages python)
35 #:use-module (gnu packages python-xyz))
37 (define-public python-lzo
44 (uri (pypi-uri "python-lzo" version))
47 "0iakqgd51n1cd7r3lpdylm2rgbmd16y74cra9kcapwg84mlf9a4p"))))
48 (build-system python-build-system)
50 `(#:test-target "check"
52 (modify-phases %standard-phases
53 (add-after 'unpack 'patch-setuppy
55 (substitute* "setup.py"
56 (("include_dirs.append\\(.*\\)")
57 (string-append "include_dirs.append('"
58 (assoc-ref %build-inputs "lzo")
64 (home-page "https://github.com/jd-boyd/python-lzo")
65 (synopsis "Python bindings for the LZO data compression library")
67 "Python-LZO provides Python bindings for LZO, i.e. you can access
68 the LZO library from your Python scripts thereby compressing ordinary
70 (license license:gpl2+)))
72 (define-public python2-lzo
73 (package-with-python2 python-lzo))
75 (define-public python-lz4
82 (uri (pypi-uri "lz4" version))
85 "0ghv1xbaq693kgww1x9c22bplz479ls9szjsaa4ig778ls834hm0"))))
86 (build-system python-build-system)
88 `(("python-nose" ,python-nose)
89 ("python-setuptools-scm" ,python-setuptools-scm)))
90 (home-page "https://github.com/python-lz4/python-lz4")
91 (synopsis "LZ4 bindings for Python")
93 "This package provides python bindings for the lz4 compression library
94 by Yann Collet. The project contains bindings for the LZ4 block format and
95 the LZ4 frame format.")
96 (license license:bsd-3)))
98 (define-public python2-lz4
99 (package-with-python2 python-lz4))
101 (define-public python-lzstring
103 (name "python-lzstring")
108 (uri (pypi-uri "lzstring" version))
111 "18ly9pppy2yspxzw7k1b23wk77k7m44rz2g0271bqgqrk3jn3yhs"))))
112 (build-system python-build-system)
114 `(("python-future" ,python-future)))
115 (home-page "https://github.com/gkovacs/lz-string-python")
116 (synopsis "String compression")
117 (description "Lz-string is a string compressor library for Python.")
118 (license license:expat)))
120 (define-public python2-lzstring
121 (package-with-python2 python-lzstring))
123 (define-public bitshuffle
129 (uri (pypi-uri "bitshuffle" version))
132 "1823x61kyax4dc2hjmc1xraskxi1193y8lvxd03vqv029jrj8cjy"))
133 (modules '((guix build utils)))
136 ;; Remove generated Cython files.
137 (delete-file "bitshuffle/h5.c")
138 (delete-file "bitshuffle/ext.c")
140 (build-system python-build-system)
142 `(#:tests? #f ; fail: https://github.com/h5py/h5py/issues/769
144 (modify-phases %standard-phases
145 (add-after 'unpack 'fix-neon-detection
146 ;; Neon is only for aarch64 ATM
147 ;; see: https://github.com/kiyo-masui/bitshuffle/pull/73
149 (substitute* "src/bitshuffle_core.c"
150 (("#define USEARMNEON")
151 "#ifdef __aarch64__\n#define USEARMNEON\n#endif"))
153 (add-after 'unpack 'dont-build-native
155 (substitute* "setup.py"
156 (("'-march=native', ") ""))
159 `(("numpy" ,python-numpy)
160 ("h5py" ,python-h5py)
163 `(("cython" ,python-cython)))
164 (home-page "https://github.com/kiyo-masui/bitshuffle")
165 (synopsis "Filter for improving compression of typed binary data")
166 (description "Bitshuffle is an algorithm that rearranges typed, binary data
167 for improving compression, as well as a python/C package that implements this
168 algorithm within the Numpy framework.")
169 (license license:expat)))
171 (define-public bitshuffle-for-snappy
174 (name "bitshuffle-for-snappy")
175 (build-system gnu-build-system)
177 (substitute-keyword-arguments (package-arguments bitshuffle)
180 `(modify-phases %standard-phases
182 (lambda* (#:key outputs #:allow-other-keys)
183 (with-output-to-file "Makefile"
186 libbitshuffle.so: src/bitshuffle.o src/bitshuffle_core.o src/iochain.o lz4/lz4.o
187 \tgcc -O3 -ffast-math -std=c99 -o $@ -shared -fPIC $^
190 \tgcc -O3 -ffast-math -std=c99 -fPIC -Isrc -Ilz4 -c $< -o $@
193 LIBDIR:=$(PREFIX)/lib
194 INCLUDEDIR:=$(PREFIX)/include
196 install: libbitshuffle.so
197 \tinstall -dm755 $(LIBDIR)
198 \tinstall -dm755 $(INCLUDEDIR)
199 \tinstall -m755 libbitshuffle.so $(LIBDIR)
200 \tinstall -m644 src/bitshuffle.h $(INCLUDEDIR)
201 \tinstall -m644 src/bitshuffle_core.h $(INCLUDEDIR)
202 \tinstall -m644 src/iochain.h $(INCLUDEDIR)
203 \tinstall -m644 lz4/lz4.h $(INCLUDEDIR)
204 " (assoc-ref outputs "out"))))
207 (native-inputs '())))