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 | |
8394619b LC |
59 | (list python-pep517 |
60 | python-setuptools | |
61 | python-setuptools-scm | |
62 | python-coverage | |
63 | python-coveralls | |
64 | python-pyannotate | |
65 | python-pytest | |
66 | python-pytest-cov)) | |
f9d8d438 BT |
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 | |
8394619b | 87 | (list python-cffi python-toml python-setuptools-scm)) |
eacfed8b | 88 | (native-inputs |
8394619b LC |
89 | (list python-setuptools python-coverage python-pytest |
90 | python-pytest-cov)) | |
eacfed8b BT |
91 | (home-page "https://github.com/miurahr/bcj-cffi") |
92 | (synopsis "Branch / Call /Jump CFFI library in Python") | |
93 | (description "This package provides an implementation of the Branch / Call / | |
94 | Jump conversion filter by CFFI for Python.") | |
95 | (license license:lgpl2.1+))) | |
96 | ||
8cc985a0 BT |
97 | (define-public python-ppmd-cffi |
98 | (package | |
99 | (name "python-ppmd-cffi") | |
100 | (version "0.3.3") | |
101 | (source | |
102 | (origin | |
103 | (method url-fetch) | |
104 | (uri (pypi-uri "ppmd-cffi" version)) | |
105 | (sha256 | |
106 | (base32 | |
107 | "01wcd9l6pp6hivdmd275qh9dhcwficjqfl67hxix5n07vvq7jzz0")))) | |
108 | (build-system python-build-system) | |
109 | (propagated-inputs | |
8394619b | 110 | (list python-cffi)) |
8cc985a0 | 111 | (native-inputs |
8394619b LC |
112 | (list python-setuptools |
113 | python-setuptools-scm | |
114 | python-pep517 | |
115 | python-coverage | |
116 | python-pytest | |
117 | python-pytest-cov)) | |
8cc985a0 BT |
118 | (home-page "https://github.com/miurahr/ppmd") |
119 | (synopsis "Prediction by Partial Matching compression library") | |
120 | (description "PPMd is a compression algorithm library using the Prediction | |
121 | by Partial Matching statistical technique. It is used in RAR and 7-Zip as one of | |
122 | several possible methods.") | |
123 | (license license:lgpl2.1+))) | |
124 | ||
875c2ece BT |
125 | (define-public python-py7zr |
126 | (package | |
127 | (name "python-py7zr") | |
128 | (version "0.14.1") | |
129 | (source | |
130 | (origin | |
131 | (method url-fetch) | |
132 | (uri (pypi-uri "py7zr" version)) | |
133 | (sha256 | |
134 | (base32 | |
135 | "1zmgp7yax328fj8yj8pj4l7yh78hp727j6wk12vfi6nmi82wl32i")))) | |
136 | (build-system python-build-system) | |
137 | (propagated-inputs | |
8394619b LC |
138 | (list python-bcj-cffi |
139 | python-multivolumefile | |
140 | python-ppmd-cffi | |
141 | python-pycryptodome | |
142 | python-pyzstd | |
143 | python-texttable | |
144 | python-zstandard)) | |
875c2ece | 145 | (native-inputs |
8394619b LC |
146 | (list python-setuptools |
147 | python-setuptools-scm | |
148 | python-coverage | |
149 | python-coveralls | |
150 | python-libarchive-c | |
151 | python-py-cpuinfo | |
152 | python-pyannotate | |
153 | python-pytest | |
154 | python-pytest-benchmark | |
155 | python-pytest-cov | |
156 | python-pytest-remotedata | |
157 | python-pytest-timeout)) | |
875c2ece BT |
158 | (home-page "https://github.com/miurahr/py7zr") |
159 | (synopsis "7-zip in Python") | |
160 | (description "This package provides py7zr, which implements 7-zip | |
161 | archive compression, decompression, encryption and decryption in | |
162 | Python.") | |
163 | (license license:lgpl2.1+))) | |
164 | ||
4fec042b RW |
165 | (define-public python-lzo |
166 | (package | |
167 | (name "python-lzo") | |
168 | (version "1.12") | |
169 | (source | |
170 | (origin | |
171 | (method url-fetch) | |
172 | (uri (pypi-uri "python-lzo" version)) | |
173 | (sha256 | |
174 | (base32 | |
175 | "0iakqgd51n1cd7r3lpdylm2rgbmd16y74cra9kcapwg84mlf9a4p")))) | |
176 | (build-system python-build-system) | |
177 | (arguments | |
178 | `(#:test-target "check" | |
179 | #:phases | |
180 | (modify-phases %standard-phases | |
181 | (add-after 'unpack 'patch-setuppy | |
182 | (lambda _ | |
183 | (substitute* "setup.py" | |
184 | (("include_dirs.append\\(.*\\)") | |
185 | (string-append "include_dirs.append('" | |
186 | (assoc-ref %build-inputs "lzo") | |
187 | "/include/lzo" | |
188 | "')"))) | |
189 | #t))))) | |
190 | (inputs | |
8394619b | 191 | (list lzo)) |
4fec042b RW |
192 | (home-page "https://github.com/jd-boyd/python-lzo") |
193 | (synopsis "Python bindings for the LZO data compression library") | |
194 | (description | |
195 | "Python-LZO provides Python bindings for LZO, i.e. you can access | |
196 | the LZO library from your Python scripts thereby compressing ordinary | |
197 | Python strings.") | |
198 | (license license:gpl2+))) | |
199 | ||
200 | (define-public python2-lzo | |
201 | (package-with-python2 python-lzo)) | |
202 | ||
203 | (define-public python-lz4 | |
204 | (package | |
205 | (name "python-lz4") | |
206 | (version "0.10.1") | |
207 | (source | |
208 | (origin | |
209 | (method url-fetch) | |
210 | (uri (pypi-uri "lz4" version)) | |
211 | (sha256 | |
212 | (base32 | |
9bf02042 MB |
213 | "0ghv1xbaq693kgww1x9c22bplz479ls9szjsaa4ig778ls834hm0")) |
214 | (modules '((guix build utils))) | |
215 | (snippet | |
216 | '(begin | |
217 | ;; Remove bundled copy of lz4. | |
218 | (delete-file-recursively "lz4libs") | |
219 | #t)))) | |
4fec042b RW |
220 | (build-system python-build-system) |
221 | (native-inputs | |
8394619b | 222 | (list pkg-config python-nose python-setuptools-scm)) |
9bf02042 | 223 | (inputs |
8394619b | 224 | (list lz4)) |
4fec042b RW |
225 | (home-page "https://github.com/python-lz4/python-lz4") |
226 | (synopsis "LZ4 bindings for Python") | |
227 | (description | |
228 | "This package provides python bindings for the lz4 compression library | |
229 | by Yann Collet. The project contains bindings for the LZ4 block format and | |
230 | the LZ4 frame format.") | |
231 | (license license:bsd-3))) | |
232 | ||
233 | (define-public python2-lz4 | |
234 | (package-with-python2 python-lz4)) | |
235 | ||
236 | (define-public python-lzstring | |
237 | (package | |
238 | (name "python-lzstring") | |
239 | (version "1.0.4") | |
240 | (source | |
241 | (origin | |
242 | (method url-fetch) | |
243 | (uri (pypi-uri "lzstring" version)) | |
244 | (sha256 | |
245 | (base32 | |
246 | "18ly9pppy2yspxzw7k1b23wk77k7m44rz2g0271bqgqrk3jn3yhs")))) | |
247 | (build-system python-build-system) | |
248 | (propagated-inputs | |
8394619b | 249 | (list python-future)) |
4fec042b RW |
250 | (home-page "https://github.com/gkovacs/lz-string-python") |
251 | (synopsis "String compression") | |
252 | (description "Lz-string is a string compressor library for Python.") | |
253 | (license license:expat))) | |
254 | ||
255 | (define-public python2-lzstring | |
256 | (package-with-python2 python-lzstring)) | |
257 | ||
258 | (define-public bitshuffle | |
259 | (package | |
260 | (name "bitshuffle") | |
261 | (version "0.3.5") | |
262 | (source (origin | |
263 | (method url-fetch) | |
264 | (uri (pypi-uri "bitshuffle" version)) | |
265 | (sha256 | |
266 | (base32 | |
267 | "1823x61kyax4dc2hjmc1xraskxi1193y8lvxd03vqv029jrj8cjy")) | |
268 | (modules '((guix build utils))) | |
269 | (snippet | |
270 | '(begin | |
271 | ;; Remove generated Cython files. | |
272 | (delete-file "bitshuffle/h5.c") | |
273 | (delete-file "bitshuffle/ext.c") | |
274 | #t)))) | |
275 | (build-system python-build-system) | |
276 | (arguments | |
277 | `(#:tests? #f ; fail: https://github.com/h5py/h5py/issues/769 | |
278 | #:phases | |
279 | (modify-phases %standard-phases | |
280 | (add-after 'unpack 'fix-neon-detection | |
281 | ;; Neon is only for aarch64 ATM | |
282 | ;; see: https://github.com/kiyo-masui/bitshuffle/pull/73 | |
283 | (lambda _ | |
284 | (substitute* "src/bitshuffle_core.c" | |
285 | (("#define USEARMNEON") | |
286 | "#ifdef __aarch64__\n#define USEARMNEON\n#endif")) | |
287 | #t)) | |
288 | (add-after 'unpack 'dont-build-native | |
289 | (lambda _ | |
290 | (substitute* "setup.py" | |
291 | (("'-march=native', ") "")) | |
292 | #t))))) | |
293 | (inputs | |
294 | `(("numpy" ,python-numpy) | |
295 | ("h5py" ,python-h5py) | |
296 | ("hdf5" ,hdf5))) | |
297 | (native-inputs | |
298 | `(("cython" ,python-cython))) | |
299 | (home-page "https://github.com/kiyo-masui/bitshuffle") | |
300 | (synopsis "Filter for improving compression of typed binary data") | |
301 | (description "Bitshuffle is an algorithm that rearranges typed, binary data | |
302 | for improving compression, as well as a python/C package that implements this | |
303 | algorithm within the Numpy framework.") | |
304 | (license license:expat))) | |
305 | ||
306 | (define-public bitshuffle-for-snappy | |
1a265842 | 307 | (package/inherit bitshuffle |
4fec042b RW |
308 | (name "bitshuffle-for-snappy") |
309 | (build-system gnu-build-system) | |
310 | (arguments | |
3e2d4e69 LC |
311 | (substitute-keyword-arguments (package-arguments bitshuffle) |
312 | ((#:tests? _ #f) #f) | |
313 | ((#:phases phases) | |
314 | `(modify-phases %standard-phases | |
315 | (replace 'configure | |
316 | (lambda* (#:key outputs #:allow-other-keys) | |
317 | (with-output-to-file "Makefile" | |
318 | (lambda _ | |
319 | (format #t "\ | |
4fec042b RW |
320 | libbitshuffle.so: src/bitshuffle.o src/bitshuffle_core.o src/iochain.o lz4/lz4.o |
321 | \tgcc -O3 -ffast-math -std=c99 -o $@ -shared -fPIC $^ | |
322 | ||
323 | %.o: %.c | |
324 | \tgcc -O3 -ffast-math -std=c99 -fPIC -Isrc -Ilz4 -c $< -o $@ | |
325 | ||
326 | PREFIX:=~a | |
327 | LIBDIR:=$(PREFIX)/lib | |
328 | INCLUDEDIR:=$(PREFIX)/include | |
329 | ||
330 | install: libbitshuffle.so | |
331 | \tinstall -dm755 $(LIBDIR) | |
332 | \tinstall -dm755 $(INCLUDEDIR) | |
333 | \tinstall -m755 libbitshuffle.so $(LIBDIR) | |
334 | \tinstall -m644 src/bitshuffle.h $(INCLUDEDIR) | |
335 | \tinstall -m644 src/bitshuffle_core.h $(INCLUDEDIR) | |
336 | \tinstall -m644 src/iochain.h $(INCLUDEDIR) | |
337 | \tinstall -m644 lz4/lz4.h $(INCLUDEDIR) | |
338 | " (assoc-ref outputs "out")))) | |
3e2d4e69 | 339 | #t)))))) |
4fec042b RW |
340 | (inputs '()) |
341 | (native-inputs '()))) | |
94f960ff RW |
342 | |
343 | (define-public python-zipp | |
344 | (package | |
345 | (name "python-zipp") | |
6b3cef84 | 346 | (version "1.0.0") |
94f960ff RW |
347 | (source |
348 | (origin | |
349 | (method url-fetch) | |
350 | (uri (pypi-uri "zipp" version)) | |
351 | (sha256 | |
352 | (base32 | |
6b3cef84 | 353 | "0v3qayhqv7vyzydpydwcp51bqciw8p2ajddw68x5k8zppc0vx3yk")))) |
94f960ff RW |
354 | (build-system python-build-system) |
355 | (propagated-inputs | |
8394619b | 356 | (list python-more-itertools)) |
6b3cef84 | 357 | (native-inputs |
8394619b | 358 | (list python-setuptools-scm)) |
94f960ff RW |
359 | (home-page "https://github.com/jaraco/zipp") |
360 | (synopsis | |
361 | "Backport of pathlib-compatible object wrapper for zip files") | |
362 | (description | |
363 | "This package provides a @code{pathlib}-compatible @code{Zipfile} object | |
364 | wrapper. It provides a backport of the @code{Path} object.") | |
bd8c62db | 365 | (properties `((python2-variant . ,(delay python2-zipp)))) |
94f960ff | 366 | (license license:expat))) |
f4a20dca | 367 | |
f15bdfeb | 368 | (define-public python2-zipp |
bd8c62db MB |
369 | (let ((base (package-with-python2 (strip-python2-variant python-zipp)))) |
370 | (package/inherit | |
371 | base | |
372 | (native-inputs | |
373 | `(("python-contextlib2" ,python2-contextlib2) | |
374 | ("python-pathlib2" ,python2-pathlib2) | |
375 | ("python-unittest2" ,python2-unittest2) | |
376 | ,@(package-native-inputs base)))))) | |
f15bdfeb | 377 | |
0ae97f5d MB |
378 | ;; This package is used to bootstrap pytest, via importlib-metadata. |
379 | (define-public python2-zipp-bootstrap | |
380 | (hidden-package | |
381 | (package/inherit | |
382 | python2-zipp | |
397b9c88 | 383 | (name "python2-zipp-bootstrap") |
0ae97f5d MB |
384 | (arguments |
385 | `(#:tests? #f | |
386 | ,@(package-arguments python2-zipp))) | |
387 | (native-inputs | |
388 | `(("python-setuptools-scm" ,python2-setuptools-scm)))))) | |
389 | ||
f4a20dca NG |
390 | (define-public python-zstandard |
391 | (package | |
fe9a113b | 392 | (name "python-zstandard") |
852f9324 | 393 | (version "0.15.2") |
fe9a113b NG |
394 | (source |
395 | (origin | |
396 | (method url-fetch) | |
397 | (uri (pypi-uri "zstandard" version)) | |
398 | (sha256 | |
852f9324 | 399 | (base32 "0by9z7nxnkzhmza075q6q91rs8lnpf91129k8ppv7kymbwshipjj")))) |
fe9a113b NG |
400 | (build-system python-build-system) |
401 | (native-inputs | |
8394619b | 402 | (list python-hypothesis)) |
fe9a113b NG |
403 | (home-page "https://github.com/indygreg/python-zstandard") |
404 | (synopsis "Zstandard bindings for Python") | |
405 | (description "This project provides Python bindings for interfacing with | |
406 | the Zstandard compression library. A C extension and CFFI interface are | |
407 | provided.") | |
408 | (license license:bsd-3))) | |
dde1c765 BT |
409 | |
410 | (define-public python-pyzstd | |
411 | (package | |
412 | (name "python-pyzstd") | |
413 | (version "0.14.3") | |
414 | (source | |
415 | (origin | |
416 | (method url-fetch) | |
417 | (uri (pypi-uri "pyzstd" version)) | |
418 | (sha256 | |
419 | (base32 | |
420 | "1d3mngs45w2p490vrq5ymd2wz4lp15phmks1ilcx4k7amgibml3d")))) | |
421 | (build-system python-build-system) | |
422 | (home-page "https://github.com/animalize/pyzstd") | |
423 | (synopsis "Zstandard bindings for Python") | |
424 | (description "This package provides Python bindings to the Zstandard (zstd) | |
425 | compression library. The API is similar to Python's bz2/lzma/zlib module.") | |
426 | (license license:bsd-3))) |