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