Commit | Line | Data |
---|---|---|
4fec042b RW |
1 | ;;; GNU Guix --- Functional package management for GNU |
2 | ;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr> | |
94f960ff | 3 | ;;; Copyright © 2017, 2019 Ricardo Wurmus <rekado@elephly.net> |
3c986a7d | 4 | ;;; Copyright © 2017 Nikita <nikita@n0.is> |
4fec042b | 5 | ;;; Copyright © 2017 Julien Lepiller <julien@lepiller.eu> |
e297edbf | 6 | ;;; Copyright © 2018, 2019, 2020 Efraim Flashner <efraim@flashner.co.il> |
2f907eea | 7 | ;;; Copyright © 2020 Nicolas Goaziou <mail@nicolasgoaziou.fr> |
0ae97f5d | 8 | ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com> |
4fec042b RW |
9 | ;;; |
10 | ;;; This file is part of GNU Guix. | |
11 | ;;; | |
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. | |
16 | ;;; | |
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. | |
21 | ;;; | |
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/>. | |
24 | ||
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) | |
9bf02042 | 36 | #:use-module (gnu packages pkg-config) |
4fec042b | 37 | #:use-module (gnu packages python) |
94f960ff RW |
38 | #:use-module (gnu packages python-xyz) |
39 | #:use-module (gnu packages sphinx)) | |
4fec042b RW |
40 | |
41 | (define-public python-lzo | |
42 | (package | |
43 | (name "python-lzo") | |
44 | (version "1.12") | |
45 | (source | |
46 | (origin | |
47 | (method url-fetch) | |
48 | (uri (pypi-uri "python-lzo" version)) | |
49 | (sha256 | |
50 | (base32 | |
51 | "0iakqgd51n1cd7r3lpdylm2rgbmd16y74cra9kcapwg84mlf9a4p")))) | |
52 | (build-system python-build-system) | |
53 | (arguments | |
54 | `(#:test-target "check" | |
55 | #:phases | |
56 | (modify-phases %standard-phases | |
57 | (add-after 'unpack 'patch-setuppy | |
58 | (lambda _ | |
59 | (substitute* "setup.py" | |
60 | (("include_dirs.append\\(.*\\)") | |
61 | (string-append "include_dirs.append('" | |
62 | (assoc-ref %build-inputs "lzo") | |
63 | "/include/lzo" | |
64 | "')"))) | |
65 | #t))))) | |
66 | (inputs | |
67 | `(("lzo" ,lzo))) | |
68 | (home-page "https://github.com/jd-boyd/python-lzo") | |
69 | (synopsis "Python bindings for the LZO data compression library") | |
70 | (description | |
71 | "Python-LZO provides Python bindings for LZO, i.e. you can access | |
72 | the LZO library from your Python scripts thereby compressing ordinary | |
73 | Python strings.") | |
74 | (license license:gpl2+))) | |
75 | ||
76 | (define-public python2-lzo | |
77 | (package-with-python2 python-lzo)) | |
78 | ||
79 | (define-public python-lz4 | |
80 | (package | |
81 | (name "python-lz4") | |
82 | (version "0.10.1") | |
83 | (source | |
84 | (origin | |
85 | (method url-fetch) | |
86 | (uri (pypi-uri "lz4" version)) | |
87 | (sha256 | |
88 | (base32 | |
9bf02042 MB |
89 | "0ghv1xbaq693kgww1x9c22bplz479ls9szjsaa4ig778ls834hm0")) |
90 | (modules '((guix build utils))) | |
91 | (snippet | |
92 | '(begin | |
93 | ;; Remove bundled copy of lz4. | |
94 | (delete-file-recursively "lz4libs") | |
95 | #t)))) | |
4fec042b RW |
96 | (build-system python-build-system) |
97 | (native-inputs | |
9bf02042 MB |
98 | `(("pkg-config" ,pkg-config) |
99 | ("python-nose" ,python-nose) | |
4fec042b | 100 | ("python-setuptools-scm" ,python-setuptools-scm))) |
9bf02042 MB |
101 | (inputs |
102 | `(("lz4" ,lz4))) | |
4fec042b RW |
103 | (home-page "https://github.com/python-lz4/python-lz4") |
104 | (synopsis "LZ4 bindings for Python") | |
105 | (description | |
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))) | |
110 | ||
111 | (define-public python2-lz4 | |
112 | (package-with-python2 python-lz4)) | |
113 | ||
114 | (define-public python-lzstring | |
115 | (package | |
116 | (name "python-lzstring") | |
117 | (version "1.0.4") | |
118 | (source | |
119 | (origin | |
120 | (method url-fetch) | |
121 | (uri (pypi-uri "lzstring" version)) | |
122 | (sha256 | |
123 | (base32 | |
124 | "18ly9pppy2yspxzw7k1b23wk77k7m44rz2g0271bqgqrk3jn3yhs")))) | |
125 | (build-system python-build-system) | |
126 | (propagated-inputs | |
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))) | |
132 | ||
133 | (define-public python2-lzstring | |
134 | (package-with-python2 python-lzstring)) | |
135 | ||
e297edbf EF |
136 | (define-public python-brotli |
137 | (package | |
138 | (name "python-brotli") | |
139 | (version "1.0.7") | |
140 | (source | |
141 | (origin | |
142 | (method url-fetch) | |
143 | (uri (pypi-uri "Brotli" version ".zip")) | |
144 | (sha256 | |
145 | (base32 | |
146 | "19x5dqxckb62n37mpnczp21rfxqvgpm0ki5ds8ac65zx8hbxqf05")))) | |
147 | (build-system python-build-system) | |
148 | (native-inputs | |
149 | `(("unzip" ,unzip))) | |
150 | (home-page "https://github.com/google/brotli") | |
151 | (synopsis "Python bindings for the Brotli compression library") | |
152 | (description | |
153 | "This package provides python bindings for the Brotli compression library.") | |
154 | (license license:asl2.0))) | |
155 | ||
4fec042b RW |
156 | (define-public bitshuffle |
157 | (package | |
158 | (name "bitshuffle") | |
159 | (version "0.3.5") | |
160 | (source (origin | |
161 | (method url-fetch) | |
162 | (uri (pypi-uri "bitshuffle" version)) | |
163 | (sha256 | |
164 | (base32 | |
165 | "1823x61kyax4dc2hjmc1xraskxi1193y8lvxd03vqv029jrj8cjy")) | |
166 | (modules '((guix build utils))) | |
167 | (snippet | |
168 | '(begin | |
169 | ;; Remove generated Cython files. | |
170 | (delete-file "bitshuffle/h5.c") | |
171 | (delete-file "bitshuffle/ext.c") | |
172 | #t)))) | |
173 | (build-system python-build-system) | |
174 | (arguments | |
175 | `(#:tests? #f ; fail: https://github.com/h5py/h5py/issues/769 | |
176 | #:phases | |
177 | (modify-phases %standard-phases | |
178 | (add-after 'unpack 'fix-neon-detection | |
179 | ;; Neon is only for aarch64 ATM | |
180 | ;; see: https://github.com/kiyo-masui/bitshuffle/pull/73 | |
181 | (lambda _ | |
182 | (substitute* "src/bitshuffle_core.c" | |
183 | (("#define USEARMNEON") | |
184 | "#ifdef __aarch64__\n#define USEARMNEON\n#endif")) | |
185 | #t)) | |
186 | (add-after 'unpack 'dont-build-native | |
187 | (lambda _ | |
188 | (substitute* "setup.py" | |
189 | (("'-march=native', ") "")) | |
190 | #t))))) | |
191 | (inputs | |
192 | `(("numpy" ,python-numpy) | |
193 | ("h5py" ,python-h5py) | |
194 | ("hdf5" ,hdf5))) | |
195 | (native-inputs | |
196 | `(("cython" ,python-cython))) | |
197 | (home-page "https://github.com/kiyo-masui/bitshuffle") | |
198 | (synopsis "Filter for improving compression of typed binary data") | |
199 | (description "Bitshuffle is an algorithm that rearranges typed, binary data | |
200 | for improving compression, as well as a python/C package that implements this | |
201 | algorithm within the Numpy framework.") | |
202 | (license license:expat))) | |
203 | ||
204 | (define-public bitshuffle-for-snappy | |
205 | (package | |
206 | (inherit bitshuffle) | |
207 | (name "bitshuffle-for-snappy") | |
208 | (build-system gnu-build-system) | |
209 | (arguments | |
3e2d4e69 LC |
210 | (substitute-keyword-arguments (package-arguments bitshuffle) |
211 | ((#:tests? _ #f) #f) | |
212 | ((#:phases phases) | |
213 | `(modify-phases %standard-phases | |
214 | (replace 'configure | |
215 | (lambda* (#:key outputs #:allow-other-keys) | |
216 | (with-output-to-file "Makefile" | |
217 | (lambda _ | |
218 | (format #t "\ | |
4fec042b RW |
219 | libbitshuffle.so: src/bitshuffle.o src/bitshuffle_core.o src/iochain.o lz4/lz4.o |
220 | \tgcc -O3 -ffast-math -std=c99 -o $@ -shared -fPIC $^ | |
221 | ||
222 | %.o: %.c | |
223 | \tgcc -O3 -ffast-math -std=c99 -fPIC -Isrc -Ilz4 -c $< -o $@ | |
224 | ||
225 | PREFIX:=~a | |
226 | LIBDIR:=$(PREFIX)/lib | |
227 | INCLUDEDIR:=$(PREFIX)/include | |
228 | ||
229 | install: libbitshuffle.so | |
230 | \tinstall -dm755 $(LIBDIR) | |
231 | \tinstall -dm755 $(INCLUDEDIR) | |
232 | \tinstall -m755 libbitshuffle.so $(LIBDIR) | |
233 | \tinstall -m644 src/bitshuffle.h $(INCLUDEDIR) | |
234 | \tinstall -m644 src/bitshuffle_core.h $(INCLUDEDIR) | |
235 | \tinstall -m644 src/iochain.h $(INCLUDEDIR) | |
236 | \tinstall -m644 lz4/lz4.h $(INCLUDEDIR) | |
237 | " (assoc-ref outputs "out")))) | |
3e2d4e69 | 238 | #t)))))) |
4fec042b RW |
239 | (inputs '()) |
240 | (native-inputs '()))) | |
94f960ff RW |
241 | |
242 | (define-public python-zipp | |
243 | (package | |
244 | (name "python-zipp") | |
6b3cef84 | 245 | (version "1.0.0") |
94f960ff RW |
246 | (source |
247 | (origin | |
248 | (method url-fetch) | |
249 | (uri (pypi-uri "zipp" version)) | |
250 | (sha256 | |
251 | (base32 | |
6b3cef84 | 252 | "0v3qayhqv7vyzydpydwcp51bqciw8p2ajddw68x5k8zppc0vx3yk")))) |
94f960ff RW |
253 | (build-system python-build-system) |
254 | (propagated-inputs | |
6b3cef84 MB |
255 | `(("python-more-itertools" ,python-more-itertools))) |
256 | (native-inputs | |
bd8c62db | 257 | `(("python-setuptools-scm" ,python-setuptools-scm))) |
94f960ff RW |
258 | (home-page "https://github.com/jaraco/zipp") |
259 | (synopsis | |
260 | "Backport of pathlib-compatible object wrapper for zip files") | |
261 | (description | |
262 | "This package provides a @code{pathlib}-compatible @code{Zipfile} object | |
263 | wrapper. It provides a backport of the @code{Path} object.") | |
bd8c62db | 264 | (properties `((python2-variant . ,(delay python2-zipp)))) |
94f960ff | 265 | (license license:expat))) |
f4a20dca | 266 | |
f15bdfeb | 267 | (define-public python2-zipp |
bd8c62db MB |
268 | (let ((base (package-with-python2 (strip-python2-variant python-zipp)))) |
269 | (package/inherit | |
270 | base | |
271 | (native-inputs | |
272 | `(("python-contextlib2" ,python2-contextlib2) | |
273 | ("python-pathlib2" ,python2-pathlib2) | |
274 | ("python-unittest2" ,python2-unittest2) | |
275 | ,@(package-native-inputs base)))))) | |
f15bdfeb | 276 | |
0ae97f5d MB |
277 | ;; This package is used to bootstrap pytest, via importlib-metadata. |
278 | (define-public python2-zipp-bootstrap | |
279 | (hidden-package | |
280 | (package/inherit | |
281 | python2-zipp | |
397b9c88 | 282 | (name "python2-zipp-bootstrap") |
0ae97f5d MB |
283 | (arguments |
284 | `(#:tests? #f | |
285 | ,@(package-arguments python2-zipp))) | |
286 | (native-inputs | |
287 | `(("python-setuptools-scm" ,python2-setuptools-scm)))))) | |
288 | ||
f4a20dca NG |
289 | (define-public python-zstandard |
290 | (package | |
fe9a113b NG |
291 | (name "python-zstandard") |
292 | (version "0.13.0") | |
293 | (source | |
294 | (origin | |
295 | (method url-fetch) | |
296 | (uri (pypi-uri "zstandard" version)) | |
297 | (sha256 | |
f4a20dca | 298 | (base32 "0q9msi00s93iqm8vzd839r7yc51gz54z90h5bckqyjdxa6vxijz5")))) |
fe9a113b NG |
299 | (build-system python-build-system) |
300 | (native-inputs | |
301 | `(("python-hypothesis" ,python-hypothesis))) | |
302 | (home-page "https://github.com/indygreg/python-zstandard") | |
303 | (synopsis "Zstandard bindings for Python") | |
304 | (description "This project provides Python bindings for interfacing with | |
305 | the Zstandard compression library. A C extension and CFFI interface are | |
306 | provided.") | |
307 | (license license:bsd-3))) |