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> |
f9d8d438 | 9 | ;;; Copyright © 2021 Brendan Tildesley <mail@brendan.scot> |
4fec042b RW |
10 | ;;; |
11 | ;;; This file is part of GNU Guix. | |
12 | ;;; | |
13 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
14 | ;;; under the terms of the GNU General Public License as published by | |
15 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
16 | ;;; your option) any later version. | |
17 | ;;; | |
18 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
19 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | ;;; GNU General Public License for more details. | |
22 | ;;; | |
23 | ;;; You should have received a copy of the GNU General Public License | |
24 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
25 | ||
26 | (define-module (gnu packages python-compression) | |
27 | #:use-module ((guix licenses) #:prefix license:) | |
28 | #:use-module (guix utils) | |
29 | #:use-module (guix packages) | |
30 | #:use-module (guix download) | |
31 | #:use-module (guix build-system gnu) | |
32 | #:use-module (guix build-system python) | |
33 | #:use-module (gnu packages) | |
8cc985a0 | 34 | #:use-module (gnu packages libffi) |
4fec042b RW |
35 | #:use-module (gnu packages compression) |
36 | #:use-module (gnu packages check) | |
37 | #:use-module (gnu packages maths) | |
9bf02042 | 38 | #:use-module (gnu packages pkg-config) |
4fec042b | 39 | #:use-module (gnu packages python) |
eacfed8b | 40 | #:use-module (gnu packages python-build) |
f9d8d438 | 41 | #:use-module (gnu packages python-check) |
875c2ece | 42 | #:use-module (gnu packages python-crypto) |
94f960ff RW |
43 | #:use-module (gnu packages python-xyz) |
44 | #:use-module (gnu packages sphinx)) | |
4fec042b | 45 | |
f9d8d438 BT |
46 | (define-public python-multivolumefile |
47 | (package | |
48 | (name "python-multivolumefile") | |
49 | (version "0.2.2") | |
50 | (source | |
51 | (origin | |
52 | (method url-fetch) | |
53 | (uri (pypi-uri "multivolumefile" version)) | |
54 | (sha256 | |
55 | (base32 | |
56 | "0j46wab4b09s3favjzp3zs1cn2sn8pr7qyngs5wn31hpqqxbbz76")))) | |
57 | (build-system python-build-system) | |
58 | (native-inputs | |
59 | `(("python-pep517" ,python-pep517) | |
60 | ("python-setuptools" ,python-setuptools) | |
61 | ("python-setuptools-scm" ,python-setuptools-scm/next) | |
62 | ("python-coverage" ,python-coverage) | |
63 | ("python-coveralls" ,python-coveralls) | |
64 | ("python-pyannotate" ,python-pyannotate) | |
65 | ("python-pytest" ,python-pytest) | |
66 | ("python-pytest-cov" ,python-pytest-cov))) | |
67 | (home-page "https://github.com/miurahr/multivolume") | |
68 | (synopsis "Treat multiple files as one") | |
69 | (description "MultiVolumefile is a Python library that provides a | |
70 | file-object abstraction, making it possible to use multiple files as if they | |
71 | were a single file.") | |
72 | (license license:lgpl2.1+))) | |
73 | ||
eacfed8b BT |
74 | (define-public python-bcj-cffi |
75 | (package | |
76 | (name "python-bcj-cffi") | |
77 | (version "0.5.0") | |
78 | (source | |
79 | (origin | |
80 | (method url-fetch) | |
81 | (uri (pypi-uri "bcj-cffi" version)) | |
82 | (sha256 | |
83 | (base32 | |
84 | "1jcczrb8zgg6w7v76w1wpz3nw75fghk3xwxkn09ll7kck7sdf68d")))) | |
85 | (build-system python-build-system) | |
86 | (propagated-inputs | |
87 | `(("python-cffi" ,python-cffi) | |
88 | ("python-toml" ,python-toml) | |
89 | ("python-setuptools-scm" ,python-setuptools-scm/next))) | |
90 | (native-inputs | |
91 | `(("python-setuptools" ,python-setuptools) | |
92 | ("python-coverage" ,python-coverage) | |
93 | ("python-pytest" ,python-pytest) | |
94 | ("python-pytest-cov" ,python-pytest-cov))) | |
95 | (home-page "https://github.com/miurahr/bcj-cffi") | |
96 | (synopsis "Branch / Call /Jump CFFI library in Python") | |
97 | (description "This package provides an implementation of the Branch / Call / | |
98 | Jump conversion filter by CFFI for Python.") | |
99 | (license license:lgpl2.1+))) | |
100 | ||
8cc985a0 BT |
101 | (define-public python-ppmd-cffi |
102 | (package | |
103 | (name "python-ppmd-cffi") | |
104 | (version "0.3.3") | |
105 | (source | |
106 | (origin | |
107 | (method url-fetch) | |
108 | (uri (pypi-uri "ppmd-cffi" version)) | |
109 | (sha256 | |
110 | (base32 | |
111 | "01wcd9l6pp6hivdmd275qh9dhcwficjqfl67hxix5n07vvq7jzz0")))) | |
112 | (build-system python-build-system) | |
113 | (propagated-inputs | |
114 | `(("python-cffi" ,python-cffi))) | |
115 | (native-inputs | |
116 | `(("python-setuptools" ,python-setuptools) | |
117 | ("python-setuptools-scm" ,python-setuptools-scm/next) | |
118 | ("python-pep517" ,python-pep517) | |
119 | ("python-coverage" ,python-coverage) | |
120 | ("python-pytest" ,python-pytest) | |
121 | ("python-pytest-cov" ,python-pytest-cov))) | |
122 | (home-page "https://github.com/miurahr/ppmd") | |
123 | (synopsis "Prediction by Partial Matching compression library") | |
124 | (description "PPMd is a compression algorithm library using the Prediction | |
125 | by Partial Matching statistical technique. It is used in RAR and 7-Zip as one of | |
126 | several possible methods.") | |
127 | (license license:lgpl2.1+))) | |
128 | ||
875c2ece BT |
129 | (define-public python-py7zr |
130 | (package | |
131 | (name "python-py7zr") | |
132 | (version "0.14.1") | |
133 | (source | |
134 | (origin | |
135 | (method url-fetch) | |
136 | (uri (pypi-uri "py7zr" version)) | |
137 | (sha256 | |
138 | (base32 | |
139 | "1zmgp7yax328fj8yj8pj4l7yh78hp727j6wk12vfi6nmi82wl32i")))) | |
140 | (build-system python-build-system) | |
141 | (propagated-inputs | |
142 | `(("python-bcj-cffi" ,python-bcj-cffi) | |
143 | ("python-multivolumefile" ,python-multivolumefile) | |
144 | ("python-ppmd-cffi" ,python-ppmd-cffi) | |
145 | ("python-pycryptodome" ,python-pycryptodome) | |
146 | ("python-pyzstd" ,python-pyzstd) | |
147 | ("python-texttable" ,python-texttable) | |
148 | ("python-zstandard" ,python-zstandard))) | |
149 | (native-inputs | |
150 | `(("python-setuptools" ,python-setuptools) | |
151 | ("python-setuptools-scm" ,python-setuptools-scm/next) | |
152 | ("python-coverage" ,python-coverage) | |
153 | ("python-coveralls" ,python-coveralls) | |
154 | ("python-libarchive-c" ,python-libarchive-c) | |
155 | ("python-py-cpuinfo" ,python-py-cpuinfo) | |
156 | ("python-pyannotate" ,python-pyannotate) | |
157 | ("python-pytest" ,python-pytest) | |
158 | ("python-pytest-benchmark" ,python-pytest-benchmark) | |
159 | ("python-pytest-cov" ,python-pytest-cov) | |
160 | ("python-pytest-remotedata" ,python-pytest-remotedata) | |
161 | ("python-pytest-timeout" ,python-pytest-timeout))) | |
162 | (home-page "https://github.com/miurahr/py7zr") | |
163 | (synopsis "7-zip in Python") | |
164 | (description "This package provides py7zr, which implements 7-zip | |
165 | archive compression, decompression, encryption and decryption in | |
166 | Python.") | |
167 | (license license:lgpl2.1+))) | |
168 | ||
4fec042b RW |
169 | (define-public python-lzo |
170 | (package | |
171 | (name "python-lzo") | |
172 | (version "1.12") | |
173 | (source | |
174 | (origin | |
175 | (method url-fetch) | |
176 | (uri (pypi-uri "python-lzo" version)) | |
177 | (sha256 | |
178 | (base32 | |
179 | "0iakqgd51n1cd7r3lpdylm2rgbmd16y74cra9kcapwg84mlf9a4p")))) | |
180 | (build-system python-build-system) | |
181 | (arguments | |
182 | `(#:test-target "check" | |
183 | #:phases | |
184 | (modify-phases %standard-phases | |
185 | (add-after 'unpack 'patch-setuppy | |
186 | (lambda _ | |
187 | (substitute* "setup.py" | |
188 | (("include_dirs.append\\(.*\\)") | |
189 | (string-append "include_dirs.append('" | |
190 | (assoc-ref %build-inputs "lzo") | |
191 | "/include/lzo" | |
192 | "')"))) | |
193 | #t))))) | |
194 | (inputs | |
195 | `(("lzo" ,lzo))) | |
196 | (home-page "https://github.com/jd-boyd/python-lzo") | |
197 | (synopsis "Python bindings for the LZO data compression library") | |
198 | (description | |
199 | "Python-LZO provides Python bindings for LZO, i.e. you can access | |
200 | the LZO library from your Python scripts thereby compressing ordinary | |
201 | Python strings.") | |
202 | (license license:gpl2+))) | |
203 | ||
204 | (define-public python2-lzo | |
205 | (package-with-python2 python-lzo)) | |
206 | ||
207 | (define-public python-lz4 | |
208 | (package | |
209 | (name "python-lz4") | |
210 | (version "0.10.1") | |
211 | (source | |
212 | (origin | |
213 | (method url-fetch) | |
214 | (uri (pypi-uri "lz4" version)) | |
215 | (sha256 | |
216 | (base32 | |
9bf02042 MB |
217 | "0ghv1xbaq693kgww1x9c22bplz479ls9szjsaa4ig778ls834hm0")) |
218 | (modules '((guix build utils))) | |
219 | (snippet | |
220 | '(begin | |
221 | ;; Remove bundled copy of lz4. | |
222 | (delete-file-recursively "lz4libs") | |
223 | #t)))) | |
4fec042b RW |
224 | (build-system python-build-system) |
225 | (native-inputs | |
9bf02042 MB |
226 | `(("pkg-config" ,pkg-config) |
227 | ("python-nose" ,python-nose) | |
4fec042b | 228 | ("python-setuptools-scm" ,python-setuptools-scm))) |
9bf02042 MB |
229 | (inputs |
230 | `(("lz4" ,lz4))) | |
4fec042b RW |
231 | (home-page "https://github.com/python-lz4/python-lz4") |
232 | (synopsis "LZ4 bindings for Python") | |
233 | (description | |
234 | "This package provides python bindings for the lz4 compression library | |
235 | by Yann Collet. The project contains bindings for the LZ4 block format and | |
236 | the LZ4 frame format.") | |
237 | (license license:bsd-3))) | |
238 | ||
239 | (define-public python2-lz4 | |
240 | (package-with-python2 python-lz4)) | |
241 | ||
242 | (define-public python-lzstring | |
243 | (package | |
244 | (name "python-lzstring") | |
245 | (version "1.0.4") | |
246 | (source | |
247 | (origin | |
248 | (method url-fetch) | |
249 | (uri (pypi-uri "lzstring" version)) | |
250 | (sha256 | |
251 | (base32 | |
252 | "18ly9pppy2yspxzw7k1b23wk77k7m44rz2g0271bqgqrk3jn3yhs")))) | |
253 | (build-system python-build-system) | |
254 | (propagated-inputs | |
255 | `(("python-future" ,python-future))) | |
256 | (home-page "https://github.com/gkovacs/lz-string-python") | |
257 | (synopsis "String compression") | |
258 | (description "Lz-string is a string compressor library for Python.") | |
259 | (license license:expat))) | |
260 | ||
261 | (define-public python2-lzstring | |
262 | (package-with-python2 python-lzstring)) | |
263 | ||
e297edbf EF |
264 | (define-public python-brotli |
265 | (package | |
266 | (name "python-brotli") | |
47f95d3f | 267 | (version "1.0.9") |
e297edbf EF |
268 | (source |
269 | (origin | |
270 | (method url-fetch) | |
271 | (uri (pypi-uri "Brotli" version ".zip")) | |
272 | (sha256 | |
273 | (base32 | |
47f95d3f | 274 | "0f4433s4wv9masc303kkb1s0a09x81xwr8pdvj0kyxzdl05826sd")))) |
e297edbf EF |
275 | (build-system python-build-system) |
276 | (native-inputs | |
277 | `(("unzip" ,unzip))) | |
278 | (home-page "https://github.com/google/brotli") | |
279 | (synopsis "Python bindings for the Brotli compression library") | |
280 | (description | |
281 | "This package provides python bindings for the Brotli compression library.") | |
282 | (license license:asl2.0))) | |
283 | ||
4fec042b RW |
284 | (define-public bitshuffle |
285 | (package | |
286 | (name "bitshuffle") | |
287 | (version "0.3.5") | |
288 | (source (origin | |
289 | (method url-fetch) | |
290 | (uri (pypi-uri "bitshuffle" version)) | |
291 | (sha256 | |
292 | (base32 | |
293 | "1823x61kyax4dc2hjmc1xraskxi1193y8lvxd03vqv029jrj8cjy")) | |
294 | (modules '((guix build utils))) | |
295 | (snippet | |
296 | '(begin | |
297 | ;; Remove generated Cython files. | |
298 | (delete-file "bitshuffle/h5.c") | |
299 | (delete-file "bitshuffle/ext.c") | |
300 | #t)))) | |
301 | (build-system python-build-system) | |
302 | (arguments | |
303 | `(#:tests? #f ; fail: https://github.com/h5py/h5py/issues/769 | |
304 | #:phases | |
305 | (modify-phases %standard-phases | |
306 | (add-after 'unpack 'fix-neon-detection | |
307 | ;; Neon is only for aarch64 ATM | |
308 | ;; see: https://github.com/kiyo-masui/bitshuffle/pull/73 | |
309 | (lambda _ | |
310 | (substitute* "src/bitshuffle_core.c" | |
311 | (("#define USEARMNEON") | |
312 | "#ifdef __aarch64__\n#define USEARMNEON\n#endif")) | |
313 | #t)) | |
314 | (add-after 'unpack 'dont-build-native | |
315 | (lambda _ | |
316 | (substitute* "setup.py" | |
317 | (("'-march=native', ") "")) | |
318 | #t))))) | |
319 | (inputs | |
320 | `(("numpy" ,python-numpy) | |
321 | ("h5py" ,python-h5py) | |
322 | ("hdf5" ,hdf5))) | |
323 | (native-inputs | |
324 | `(("cython" ,python-cython))) | |
325 | (home-page "https://github.com/kiyo-masui/bitshuffle") | |
326 | (synopsis "Filter for improving compression of typed binary data") | |
327 | (description "Bitshuffle is an algorithm that rearranges typed, binary data | |
328 | for improving compression, as well as a python/C package that implements this | |
329 | algorithm within the Numpy framework.") | |
330 | (license license:expat))) | |
331 | ||
332 | (define-public bitshuffle-for-snappy | |
1a265842 | 333 | (package/inherit bitshuffle |
4fec042b RW |
334 | (name "bitshuffle-for-snappy") |
335 | (build-system gnu-build-system) | |
336 | (arguments | |
3e2d4e69 LC |
337 | (substitute-keyword-arguments (package-arguments bitshuffle) |
338 | ((#:tests? _ #f) #f) | |
339 | ((#:phases phases) | |
340 | `(modify-phases %standard-phases | |
341 | (replace 'configure | |
342 | (lambda* (#:key outputs #:allow-other-keys) | |
343 | (with-output-to-file "Makefile" | |
344 | (lambda _ | |
345 | (format #t "\ | |
4fec042b RW |
346 | libbitshuffle.so: src/bitshuffle.o src/bitshuffle_core.o src/iochain.o lz4/lz4.o |
347 | \tgcc -O3 -ffast-math -std=c99 -o $@ -shared -fPIC $^ | |
348 | ||
349 | %.o: %.c | |
350 | \tgcc -O3 -ffast-math -std=c99 -fPIC -Isrc -Ilz4 -c $< -o $@ | |
351 | ||
352 | PREFIX:=~a | |
353 | LIBDIR:=$(PREFIX)/lib | |
354 | INCLUDEDIR:=$(PREFIX)/include | |
355 | ||
356 | install: libbitshuffle.so | |
357 | \tinstall -dm755 $(LIBDIR) | |
358 | \tinstall -dm755 $(INCLUDEDIR) | |
359 | \tinstall -m755 libbitshuffle.so $(LIBDIR) | |
360 | \tinstall -m644 src/bitshuffle.h $(INCLUDEDIR) | |
361 | \tinstall -m644 src/bitshuffle_core.h $(INCLUDEDIR) | |
362 | \tinstall -m644 src/iochain.h $(INCLUDEDIR) | |
363 | \tinstall -m644 lz4/lz4.h $(INCLUDEDIR) | |
364 | " (assoc-ref outputs "out")))) | |
3e2d4e69 | 365 | #t)))))) |
4fec042b RW |
366 | (inputs '()) |
367 | (native-inputs '()))) | |
94f960ff RW |
368 | |
369 | (define-public python-zipp | |
370 | (package | |
371 | (name "python-zipp") | |
6b3cef84 | 372 | (version "1.0.0") |
94f960ff RW |
373 | (source |
374 | (origin | |
375 | (method url-fetch) | |
376 | (uri (pypi-uri "zipp" version)) | |
377 | (sha256 | |
378 | (base32 | |
6b3cef84 | 379 | "0v3qayhqv7vyzydpydwcp51bqciw8p2ajddw68x5k8zppc0vx3yk")))) |
94f960ff RW |
380 | (build-system python-build-system) |
381 | (propagated-inputs | |
6b3cef84 MB |
382 | `(("python-more-itertools" ,python-more-itertools))) |
383 | (native-inputs | |
bd8c62db | 384 | `(("python-setuptools-scm" ,python-setuptools-scm))) |
94f960ff RW |
385 | (home-page "https://github.com/jaraco/zipp") |
386 | (synopsis | |
387 | "Backport of pathlib-compatible object wrapper for zip files") | |
388 | (description | |
389 | "This package provides a @code{pathlib}-compatible @code{Zipfile} object | |
390 | wrapper. It provides a backport of the @code{Path} object.") | |
bd8c62db | 391 | (properties `((python2-variant . ,(delay python2-zipp)))) |
94f960ff | 392 | (license license:expat))) |
f4a20dca | 393 | |
f15bdfeb | 394 | (define-public python2-zipp |
bd8c62db MB |
395 | (let ((base (package-with-python2 (strip-python2-variant python-zipp)))) |
396 | (package/inherit | |
397 | base | |
398 | (native-inputs | |
399 | `(("python-contextlib2" ,python2-contextlib2) | |
400 | ("python-pathlib2" ,python2-pathlib2) | |
401 | ("python-unittest2" ,python2-unittest2) | |
402 | ,@(package-native-inputs base)))))) | |
f15bdfeb | 403 | |
0ae97f5d MB |
404 | ;; This package is used to bootstrap pytest, via importlib-metadata. |
405 | (define-public python2-zipp-bootstrap | |
406 | (hidden-package | |
407 | (package/inherit | |
408 | python2-zipp | |
397b9c88 | 409 | (name "python2-zipp-bootstrap") |
0ae97f5d MB |
410 | (arguments |
411 | `(#:tests? #f | |
412 | ,@(package-arguments python2-zipp))) | |
413 | (native-inputs | |
414 | `(("python-setuptools-scm" ,python2-setuptools-scm)))))) | |
415 | ||
f4a20dca NG |
416 | (define-public python-zstandard |
417 | (package | |
fe9a113b | 418 | (name "python-zstandard") |
852f9324 | 419 | (version "0.15.2") |
fe9a113b NG |
420 | (source |
421 | (origin | |
422 | (method url-fetch) | |
423 | (uri (pypi-uri "zstandard" version)) | |
424 | (sha256 | |
852f9324 | 425 | (base32 "0by9z7nxnkzhmza075q6q91rs8lnpf91129k8ppv7kymbwshipjj")))) |
fe9a113b NG |
426 | (build-system python-build-system) |
427 | (native-inputs | |
428 | `(("python-hypothesis" ,python-hypothesis))) | |
429 | (home-page "https://github.com/indygreg/python-zstandard") | |
430 | (synopsis "Zstandard bindings for Python") | |
431 | (description "This project provides Python bindings for interfacing with | |
432 | the Zstandard compression library. A C extension and CFFI interface are | |
433 | provided.") | |
434 | (license license:bsd-3))) | |
dde1c765 BT |
435 | |
436 | (define-public python-pyzstd | |
437 | (package | |
438 | (name "python-pyzstd") | |
439 | (version "0.14.3") | |
440 | (source | |
441 | (origin | |
442 | (method url-fetch) | |
443 | (uri (pypi-uri "pyzstd" version)) | |
444 | (sha256 | |
445 | (base32 | |
446 | "1d3mngs45w2p490vrq5ymd2wz4lp15phmks1ilcx4k7amgibml3d")))) | |
447 | (build-system python-build-system) | |
448 | (home-page "https://github.com/animalize/pyzstd") | |
449 | (synopsis "Zstandard bindings for Python") | |
450 | (description "This package provides Python bindings to the Zstandard (zstd) | |
451 | compression library. The API is similar to Python's bz2/lzma/zlib module.") | |
452 | (license license:bsd-3))) |