gnu: rust-percent-encoding-2: Update to 2.2.0.
[jackhill/guix/guix.git] / gnu / packages / datamash.scm
CommitLineData
501aa54f 1;;; GNU Guix --- Functional package management for GNU
de7f234a 2;;; Copyright © 2014, 2018 Eric Bavier <bavier@member.fsf.org>
ecc98861 3;;; Copyright © 2016-2020, 2022 Efraim Flashner <efraim@flashner.co.il>
501aa54f
EB
4;;;
5;;; This file is part of GNU Guix.
6;;;
7;;; GNU Guix is free software; you can redistribute it and/or modify it
8;;; under the terms of the GNU General Public License as published by
9;;; the Free Software Foundation; either version 3 of the License, or (at
10;;; your option) any later version.
11;;;
12;;; GNU Guix is distributed in the hope that it will be useful, but
13;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;;; GNU General Public License for more details.
16;;;
17;;; You should have received a copy of the GNU General Public License
18;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19
20(define-module (gnu packages datamash)
21 #:use-module (guix packages)
22 #:use-module (guix licenses)
23 #:use-module (guix download)
7ab05543 24 #:use-module (guix git-download)
501aa54f 25 #:use-module (guix build-system gnu)
7ab05543
MB
26 #:use-module (guix gexp)
27 #:use-module (guix utils)
de7f234a 28 #:use-module (gnu packages)
7ab05543
MB
29 #:use-module (gnu packages base)
30 #:use-module (gnu packages gawk)
501aa54f 31 #:use-module (gnu packages perl)
7ab05543
MB
32 #:use-module (gnu packages python)
33 #:use-module (gnu packages python-xyz))
501aa54f
EB
34
35(define-public datamash
36 (package
37 (name "datamash")
ecc98861 38 (version "1.8")
501aa54f
EB
39 (source
40 (origin
41 (method url-fetch)
42 (uri (string-append "mirror://gnu/datamash/datamash-"
43 version ".tar.gz"))
44 (sha256
45 (base32
ecc98861 46 "1zgn55gvf60w2rs5f7vx7vdp50j89ki7mmjvm81xs5pngs67xnbs"))))
501aa54f 47 (native-inputs
8394619b
LC
48 (list which ;for tests
49 perl)) ;for help2man
501aa54f
EB
50 (build-system gnu-build-system)
51 (home-page "https://www.gnu.org/software/datamash/")
52 (synopsis "Scriptable statistics and data calculation")
53 (description
54 "Perform basic numeric, textual and statistical operations on plain text
55files. Designed to work within standard pipelines without additional code.")
a423555d 56 (license gpl3+)))
7ab05543
MB
57
58(define-public vnlog
59 (package
60 (name "vnlog")
61 (version "1.32")
62 (home-page "https://github.com/dkogan/vnlog")
63 (source (origin
64 (method git-fetch)
65 (uri (git-reference
66 (url home-page)
67 (commit (string-append "v" version))))
68 (file-name (git-file-name name version))
69 (sha256
70 (base32
71 "1g4insm6gkw3c82fq8q9swkdha3cncbz1nib15yg9b2s4yl123hm"))))
72 (build-system gnu-build-system)
73 (native-inputs
74 (list python-numpy)) ;for tests
75 (inputs
76 (list mawk
77 perl
78 perl-ipc-run
79 perl-list-moreutils
80 perl-string-shellquote
81 perl-text-diff
82 perl-text-table
83 python-wrapper))
84 (arguments
85 (list #:make-flags
86 #~(list (string-append "CC=" #$(cc-for-target))
87 (string-append "DESTDIR=" #$output)
88 "USRLIB=lib"
89 "MANDIR=share/man"
90 (string-append "PY3_MODULE_PATH=lib/python"
91 #$(version-major+minor
92 (package-version
93 (this-package-input "python-wrapper")))
94 "/site-packages")
95 ;; Do not install the Python 2 modules.
96 "DIST_PY2_MODULES=")
97 #:phases
98 #~(modify-phases %standard-phases
99 (add-after 'unpack 'adjust-Makefile
100 (lambda _
101 (substitute* "GNUmakefile"
102 ;; Install Perl modules to the usual location.
103 (("/usr/share/perl5")
104 (string-append "/lib/perl5/site_perl/"
105 #$(package-version
106 (this-package-input "perl"))))
107 ;; Do not add a '/usr' suffix to DESTDIR.
108 (("\\$\\(DESTDIR\\)/usr")
109 "$(DESTDIR)")
110 ;; Do not strip RUNPATH from the installed C library.
111 ((".*find.*chrpath.*")
112 ""))))
113 (add-after 'unpack 'use-absolute-mawk
114 (lambda* (#:key inputs #:allow-other-keys)
115 (let ((mawk (search-input-file inputs "bin/mawk")))
116 (substitute* '("vnl-filter" "lib/Vnlog/Util.pm")
117 (("'mawk'")
118 (string-append "'" mawk "'"))))))
119 (delete 'configure)
120 (add-before 'check 'disable-python2-test
121 (lambda _
122 (delete-file "test/test_python2_parser.sh")
123 (substitute* "GNUmakefile"
124 ((".*test/test_python2_parser\\.sh\\.RUN.*")
125 ""))))
126 (add-after 'install 'wrap
127 (lambda* (#:key inputs outputs #:allow-other-keys)
128 (let* ((out (assoc-ref outputs "out"))
129 (PERL5LIB (string-append
130 out "/lib/perl5/site_perl/"
131 #$(package-version
132 (this-package-input "perl"))
133 ":" (getenv "PERL5LIB"))))
134 (for-each (lambda (script)
135 (wrap-program script
136 `("PERL5LIB" ":" prefix (,PERL5LIB))))
137 (find-files (string-append out "/bin"))))))
138 (add-after 'wrap 'check-wrapped-executables
139 (lambda* (#:key outputs #:allow-other-keys)
140 (let ((out (assoc-ref outputs "out")))
141 ;; Assert that the installed Perl scripts can find
142 ;; their dependencies even when PERL5LIB is unset.
143 (unsetenv "PERL5LIB")
144 (for-each (lambda (script)
145 (invoke/quiet script "--help"))
146 (find-files (string-append out "/bin")
147 "^vnl-[[:lower:]]+$"))))))))
148 (synopsis "Process labelled tabular ASCII data on the command line")
149 (description
150 "Vnlog (pronounced @dfn{vanillog}) is a toolkit for manipulating
151tabular ASCII data with labelled fields using regular command-line tools.")
152 (license lgpl2.1+)))