gnu: emacs-scel: Fix build.
[jackhill/guix/guix.git] / gnu / packages / python-compression.scm
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 ;;;
8 ;;; This file is part of GNU Guix.
9 ;;;
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.
14 ;;;
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.
19 ;;;
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/>.
22
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)
36 #:use-module (gnu packages sphinx))
37
38 (define-public python-lzo
39 (package
40 (name "python-lzo")
41 (version "1.12")
42 (source
43 (origin
44 (method url-fetch)
45 (uri (pypi-uri "python-lzo" version))
46 (sha256
47 (base32
48 "0iakqgd51n1cd7r3lpdylm2rgbmd16y74cra9kcapwg84mlf9a4p"))))
49 (build-system python-build-system)
50 (arguments
51 `(#:test-target "check"
52 #:phases
53 (modify-phases %standard-phases
54 (add-after 'unpack 'patch-setuppy
55 (lambda _
56 (substitute* "setup.py"
57 (("include_dirs.append\\(.*\\)")
58 (string-append "include_dirs.append('"
59 (assoc-ref %build-inputs "lzo")
60 "/include/lzo"
61 "')")))
62 #t)))))
63 (inputs
64 `(("lzo" ,lzo)))
65 (home-page "https://github.com/jd-boyd/python-lzo")
66 (synopsis "Python bindings for the LZO data compression library")
67 (description
68 "Python-LZO provides Python bindings for LZO, i.e. you can access
69 the LZO library from your Python scripts thereby compressing ordinary
70 Python strings.")
71 (license license:gpl2+)))
72
73 (define-public python2-lzo
74 (package-with-python2 python-lzo))
75
76 (define-public python-lz4
77 (package
78 (name "python-lz4")
79 (version "0.10.1")
80 (source
81 (origin
82 (method url-fetch)
83 (uri (pypi-uri "lz4" version))
84 (sha256
85 (base32
86 "0ghv1xbaq693kgww1x9c22bplz479ls9szjsaa4ig778ls834hm0"))))
87 (build-system python-build-system)
88 (native-inputs
89 `(("python-nose" ,python-nose)
90 ("python-setuptools-scm" ,python-setuptools-scm)))
91 (home-page "https://github.com/python-lz4/python-lz4")
92 (synopsis "LZ4 bindings for Python")
93 (description
94 "This package provides python bindings for the lz4 compression library
95 by Yann Collet. The project contains bindings for the LZ4 block format and
96 the LZ4 frame format.")
97 (license license:bsd-3)))
98
99 (define-public python2-lz4
100 (package-with-python2 python-lz4))
101
102 (define-public python-lzstring
103 (package
104 (name "python-lzstring")
105 (version "1.0.4")
106 (source
107 (origin
108 (method url-fetch)
109 (uri (pypi-uri "lzstring" version))
110 (sha256
111 (base32
112 "18ly9pppy2yspxzw7k1b23wk77k7m44rz2g0271bqgqrk3jn3yhs"))))
113 (build-system python-build-system)
114 (propagated-inputs
115 `(("python-future" ,python-future)))
116 (home-page "https://github.com/gkovacs/lz-string-python")
117 (synopsis "String compression")
118 (description "Lz-string is a string compressor library for Python.")
119 (license license:expat)))
120
121 (define-public python2-lzstring
122 (package-with-python2 python-lzstring))
123
124 (define-public bitshuffle
125 (package
126 (name "bitshuffle")
127 (version "0.3.5")
128 (source (origin
129 (method url-fetch)
130 (uri (pypi-uri "bitshuffle" version))
131 (sha256
132 (base32
133 "1823x61kyax4dc2hjmc1xraskxi1193y8lvxd03vqv029jrj8cjy"))
134 (modules '((guix build utils)))
135 (snippet
136 '(begin
137 ;; Remove generated Cython files.
138 (delete-file "bitshuffle/h5.c")
139 (delete-file "bitshuffle/ext.c")
140 #t))))
141 (build-system python-build-system)
142 (arguments
143 `(#:tests? #f ; fail: https://github.com/h5py/h5py/issues/769
144 #:phases
145 (modify-phases %standard-phases
146 (add-after 'unpack 'fix-neon-detection
147 ;; Neon is only for aarch64 ATM
148 ;; see: https://github.com/kiyo-masui/bitshuffle/pull/73
149 (lambda _
150 (substitute* "src/bitshuffle_core.c"
151 (("#define USEARMNEON")
152 "#ifdef __aarch64__\n#define USEARMNEON\n#endif"))
153 #t))
154 (add-after 'unpack 'dont-build-native
155 (lambda _
156 (substitute* "setup.py"
157 (("'-march=native', ") ""))
158 #t)))))
159 (inputs
160 `(("numpy" ,python-numpy)
161 ("h5py" ,python-h5py)
162 ("hdf5" ,hdf5)))
163 (native-inputs
164 `(("cython" ,python-cython)))
165 (home-page "https://github.com/kiyo-masui/bitshuffle")
166 (synopsis "Filter for improving compression of typed binary data")
167 (description "Bitshuffle is an algorithm that rearranges typed, binary data
168 for improving compression, as well as a python/C package that implements this
169 algorithm within the Numpy framework.")
170 (license license:expat)))
171
172 (define-public bitshuffle-for-snappy
173 (package
174 (inherit bitshuffle)
175 (name "bitshuffle-for-snappy")
176 (build-system gnu-build-system)
177 (arguments
178 (substitute-keyword-arguments (package-arguments bitshuffle)
179 ((#:tests? _ #f) #f)
180 ((#:phases phases)
181 `(modify-phases %standard-phases
182 (replace 'configure
183 (lambda* (#:key outputs #:allow-other-keys)
184 (with-output-to-file "Makefile"
185 (lambda _
186 (format #t "\
187 libbitshuffle.so: src/bitshuffle.o src/bitshuffle_core.o src/iochain.o lz4/lz4.o
188 \tgcc -O3 -ffast-math -std=c99 -o $@ -shared -fPIC $^
189
190 %.o: %.c
191 \tgcc -O3 -ffast-math -std=c99 -fPIC -Isrc -Ilz4 -c $< -o $@
192
193 PREFIX:=~a
194 LIBDIR:=$(PREFIX)/lib
195 INCLUDEDIR:=$(PREFIX)/include
196
197 install: libbitshuffle.so
198 \tinstall -dm755 $(LIBDIR)
199 \tinstall -dm755 $(INCLUDEDIR)
200 \tinstall -m755 libbitshuffle.so $(LIBDIR)
201 \tinstall -m644 src/bitshuffle.h $(INCLUDEDIR)
202 \tinstall -m644 src/bitshuffle_core.h $(INCLUDEDIR)
203 \tinstall -m644 src/iochain.h $(INCLUDEDIR)
204 \tinstall -m644 lz4/lz4.h $(INCLUDEDIR)
205 " (assoc-ref outputs "out"))))
206 #t))))))
207 (inputs '())
208 (native-inputs '())))
209
210 (define-public python-zipp
211 (package
212 (name "python-zipp")
213 (version "0.5.1")
214 (source
215 (origin
216 (method url-fetch)
217 (uri (pypi-uri "zipp" version))
218 (sha256
219 (base32
220 "1hsv4zwy1pwnbrr63wjjkpwrmnk36ngbkkqw01bj5hcwh1z3m56a"))))
221 (build-system python-build-system)
222 (propagated-inputs
223 `(("python-contextlib2" ,python-contextlib2)
224 ("python-pathlib2" ,python-pathlib2)
225 ("python-rst.linker" ,python-rst.linker)))
226 (native-inputs
227 `(("python-setuptools-scm" ,python-setuptools-scm)
228 ("python-sphinx" ,python-sphinx)
229 ("python-unittest2" ,python-unittest2)))
230 (home-page "https://github.com/jaraco/zipp")
231 (synopsis
232 "Backport of pathlib-compatible object wrapper for zip files")
233 (description
234 "This package provides a @code{pathlib}-compatible @code{Zipfile} object
235 wrapper. It provides a backport of the @code{Path} object.")
236 (license license:expat)))