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> |
47956fa0 | 4 | ;;; Copyright © 2017 ng0 <ng0@n0.is> |
4fec042b RW |
5 | ;;; Copyright © 2017 Julien Lepiller <julien@lepiller.eu> |
6 | ;;; Copyright © 2018, 2019 Efraim Flashner <efraim@flashner.co.il> | |
2f907eea | 7 | ;;; Copyright © 2020 Nicolas Goaziou <mail@nicolasgoaziou.fr> |
4fec042b RW |
8 | ;;; |
9 | ;;; This file is part of GNU Guix. | |
10 | ;;; | |
11 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
12 | ;;; under the terms of the GNU General Public License as published by | |
13 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
14 | ;;; your option) any later version. | |
15 | ;;; | |
16 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
17 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 | ;;; GNU General Public License for more details. | |
20 | ;;; | |
21 | ;;; You should have received a copy of the GNU General Public License | |
22 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
23 | ||
24 | (define-module (gnu packages python-compression) | |
25 | #:use-module ((guix licenses) #:prefix license:) | |
26 | #:use-module (guix utils) | |
27 | #:use-module (guix packages) | |
28 | #:use-module (guix download) | |
29 | #:use-module (guix build-system gnu) | |
30 | #:use-module (guix build-system python) | |
31 | #:use-module (gnu packages) | |
32 | #:use-module (gnu packages compression) | |
33 | #:use-module (gnu packages check) | |
34 | #:use-module (gnu packages maths) | |
35 | #:use-module (gnu packages python) | |
94f960ff RW |
36 | #:use-module (gnu packages python-xyz) |
37 | #:use-module (gnu packages sphinx)) | |
4fec042b RW |
38 | |
39 | (define-public python-lzo | |
40 | (package | |
41 | (name "python-lzo") | |
42 | (version "1.12") | |
43 | (source | |
44 | (origin | |
45 | (method url-fetch) | |
46 | (uri (pypi-uri "python-lzo" version)) | |
47 | (sha256 | |
48 | (base32 | |
49 | "0iakqgd51n1cd7r3lpdylm2rgbmd16y74cra9kcapwg84mlf9a4p")))) | |
50 | (build-system python-build-system) | |
51 | (arguments | |
52 | `(#:test-target "check" | |
53 | #:phases | |
54 | (modify-phases %standard-phases | |
55 | (add-after 'unpack 'patch-setuppy | |
56 | (lambda _ | |
57 | (substitute* "setup.py" | |
58 | (("include_dirs.append\\(.*\\)") | |
59 | (string-append "include_dirs.append('" | |
60 | (assoc-ref %build-inputs "lzo") | |
61 | "/include/lzo" | |
62 | "')"))) | |
63 | #t))))) | |
64 | (inputs | |
65 | `(("lzo" ,lzo))) | |
66 | (home-page "https://github.com/jd-boyd/python-lzo") | |
67 | (synopsis "Python bindings for the LZO data compression library") | |
68 | (description | |
69 | "Python-LZO provides Python bindings for LZO, i.e. you can access | |
70 | the LZO library from your Python scripts thereby compressing ordinary | |
71 | Python strings.") | |
72 | (license license:gpl2+))) | |
73 | ||
74 | (define-public python2-lzo | |
75 | (package-with-python2 python-lzo)) | |
76 | ||
77 | (define-public python-lz4 | |
78 | (package | |
79 | (name "python-lz4") | |
80 | (version "0.10.1") | |
81 | (source | |
82 | (origin | |
83 | (method url-fetch) | |
84 | (uri (pypi-uri "lz4" version)) | |
85 | (sha256 | |
86 | (base32 | |
87 | "0ghv1xbaq693kgww1x9c22bplz479ls9szjsaa4ig778ls834hm0")))) | |
88 | (build-system python-build-system) | |
89 | (native-inputs | |
90 | `(("python-nose" ,python-nose) | |
91 | ("python-setuptools-scm" ,python-setuptools-scm))) | |
92 | (home-page "https://github.com/python-lz4/python-lz4") | |
93 | (synopsis "LZ4 bindings for Python") | |
94 | (description | |
95 | "This package provides python bindings for the lz4 compression library | |
96 | by Yann Collet. The project contains bindings for the LZ4 block format and | |
97 | the LZ4 frame format.") | |
98 | (license license:bsd-3))) | |
99 | ||
100 | (define-public python2-lz4 | |
101 | (package-with-python2 python-lz4)) | |
102 | ||
103 | (define-public python-lzstring | |
104 | (package | |
105 | (name "python-lzstring") | |
106 | (version "1.0.4") | |
107 | (source | |
108 | (origin | |
109 | (method url-fetch) | |
110 | (uri (pypi-uri "lzstring" version)) | |
111 | (sha256 | |
112 | (base32 | |
113 | "18ly9pppy2yspxzw7k1b23wk77k7m44rz2g0271bqgqrk3jn3yhs")))) | |
114 | (build-system python-build-system) | |
115 | (propagated-inputs | |
116 | `(("python-future" ,python-future))) | |
117 | (home-page "https://github.com/gkovacs/lz-string-python") | |
118 | (synopsis "String compression") | |
119 | (description "Lz-string is a string compressor library for Python.") | |
120 | (license license:expat))) | |
121 | ||
122 | (define-public python2-lzstring | |
123 | (package-with-python2 python-lzstring)) | |
124 | ||
125 | (define-public bitshuffle | |
126 | (package | |
127 | (name "bitshuffle") | |
128 | (version "0.3.5") | |
129 | (source (origin | |
130 | (method url-fetch) | |
131 | (uri (pypi-uri "bitshuffle" version)) | |
132 | (sha256 | |
133 | (base32 | |
134 | "1823x61kyax4dc2hjmc1xraskxi1193y8lvxd03vqv029jrj8cjy")) | |
135 | (modules '((guix build utils))) | |
136 | (snippet | |
137 | '(begin | |
138 | ;; Remove generated Cython files. | |
139 | (delete-file "bitshuffle/h5.c") | |
140 | (delete-file "bitshuffle/ext.c") | |
141 | #t)))) | |
142 | (build-system python-build-system) | |
143 | (arguments | |
144 | `(#:tests? #f ; fail: https://github.com/h5py/h5py/issues/769 | |
145 | #:phases | |
146 | (modify-phases %standard-phases | |
147 | (add-after 'unpack 'fix-neon-detection | |
148 | ;; Neon is only for aarch64 ATM | |
149 | ;; see: https://github.com/kiyo-masui/bitshuffle/pull/73 | |
150 | (lambda _ | |
151 | (substitute* "src/bitshuffle_core.c" | |
152 | (("#define USEARMNEON") | |
153 | "#ifdef __aarch64__\n#define USEARMNEON\n#endif")) | |
154 | #t)) | |
155 | (add-after 'unpack 'dont-build-native | |
156 | (lambda _ | |
157 | (substitute* "setup.py" | |
158 | (("'-march=native', ") "")) | |
159 | #t))))) | |
160 | (inputs | |
161 | `(("numpy" ,python-numpy) | |
162 | ("h5py" ,python-h5py) | |
163 | ("hdf5" ,hdf5))) | |
164 | (native-inputs | |
165 | `(("cython" ,python-cython))) | |
166 | (home-page "https://github.com/kiyo-masui/bitshuffle") | |
167 | (synopsis "Filter for improving compression of typed binary data") | |
168 | (description "Bitshuffle is an algorithm that rearranges typed, binary data | |
169 | for improving compression, as well as a python/C package that implements this | |
170 | algorithm within the Numpy framework.") | |
171 | (license license:expat))) | |
172 | ||
173 | (define-public bitshuffle-for-snappy | |
174 | (package | |
175 | (inherit bitshuffle) | |
176 | (name "bitshuffle-for-snappy") | |
177 | (build-system gnu-build-system) | |
178 | (arguments | |
3e2d4e69 LC |
179 | (substitute-keyword-arguments (package-arguments bitshuffle) |
180 | ((#:tests? _ #f) #f) | |
181 | ((#:phases phases) | |
182 | `(modify-phases %standard-phases | |
183 | (replace 'configure | |
184 | (lambda* (#:key outputs #:allow-other-keys) | |
185 | (with-output-to-file "Makefile" | |
186 | (lambda _ | |
187 | (format #t "\ | |
4fec042b RW |
188 | libbitshuffle.so: src/bitshuffle.o src/bitshuffle_core.o src/iochain.o lz4/lz4.o |
189 | \tgcc -O3 -ffast-math -std=c99 -o $@ -shared -fPIC $^ | |
190 | ||
191 | %.o: %.c | |
192 | \tgcc -O3 -ffast-math -std=c99 -fPIC -Isrc -Ilz4 -c $< -o $@ | |
193 | ||
194 | PREFIX:=~a | |
195 | LIBDIR:=$(PREFIX)/lib | |
196 | INCLUDEDIR:=$(PREFIX)/include | |
197 | ||
198 | install: libbitshuffle.so | |
199 | \tinstall -dm755 $(LIBDIR) | |
200 | \tinstall -dm755 $(INCLUDEDIR) | |
201 | \tinstall -m755 libbitshuffle.so $(LIBDIR) | |
202 | \tinstall -m644 src/bitshuffle.h $(INCLUDEDIR) | |
203 | \tinstall -m644 src/bitshuffle_core.h $(INCLUDEDIR) | |
204 | \tinstall -m644 src/iochain.h $(INCLUDEDIR) | |
205 | \tinstall -m644 lz4/lz4.h $(INCLUDEDIR) | |
206 | " (assoc-ref outputs "out")))) | |
3e2d4e69 | 207 | #t)))))) |
4fec042b RW |
208 | (inputs '()) |
209 | (native-inputs '()))) | |
94f960ff RW |
210 | |
211 | (define-public python-zipp | |
212 | (package | |
213 | (name "python-zipp") | |
6b3cef84 | 214 | (version "1.0.0") |
94f960ff RW |
215 | (source |
216 | (origin | |
217 | (method url-fetch) | |
218 | (uri (pypi-uri "zipp" version)) | |
219 | (sha256 | |
220 | (base32 | |
6b3cef84 | 221 | "0v3qayhqv7vyzydpydwcp51bqciw8p2ajddw68x5k8zppc0vx3yk")))) |
94f960ff RW |
222 | (build-system python-build-system) |
223 | (propagated-inputs | |
6b3cef84 MB |
224 | `(("python-more-itertools" ,python-more-itertools))) |
225 | (native-inputs | |
bd8c62db | 226 | `(("python-setuptools-scm" ,python-setuptools-scm))) |
94f960ff RW |
227 | (home-page "https://github.com/jaraco/zipp") |
228 | (synopsis | |
229 | "Backport of pathlib-compatible object wrapper for zip files") | |
230 | (description | |
231 | "This package provides a @code{pathlib}-compatible @code{Zipfile} object | |
232 | wrapper. It provides a backport of the @code{Path} object.") | |
bd8c62db | 233 | (properties `((python2-variant . ,(delay python2-zipp)))) |
94f960ff | 234 | (license license:expat))) |
f4a20dca | 235 | |
f15bdfeb | 236 | (define-public python2-zipp |
bd8c62db MB |
237 | (let ((base (package-with-python2 (strip-python2-variant python-zipp)))) |
238 | (package/inherit | |
239 | base | |
240 | (native-inputs | |
241 | `(("python-contextlib2" ,python2-contextlib2) | |
242 | ("python-pathlib2" ,python2-pathlib2) | |
243 | ("python-unittest2" ,python2-unittest2) | |
244 | ,@(package-native-inputs base)))))) | |
f15bdfeb | 245 | |
f4a20dca NG |
246 | (define-public python-zstandard |
247 | (package | |
fe9a113b NG |
248 | (name "python-zstandard") |
249 | (version "0.13.0") | |
250 | (source | |
251 | (origin | |
252 | (method url-fetch) | |
253 | (uri (pypi-uri "zstandard" version)) | |
254 | (sha256 | |
f4a20dca | 255 | (base32 "0q9msi00s93iqm8vzd839r7yc51gz54z90h5bckqyjdxa6vxijz5")))) |
fe9a113b NG |
256 | (build-system python-build-system) |
257 | (native-inputs | |
258 | `(("python-hypothesis" ,python-hypothesis))) | |
259 | (home-page "https://github.com/indygreg/python-zstandard") | |
260 | (synopsis "Zstandard bindings for Python") | |
261 | (description "This project provides Python bindings for interfacing with | |
262 | the Zstandard compression library. A C extension and CFFI interface are | |
263 | provided.") | |
264 | (license license:bsd-3))) |