1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
|
{ stdenv
, lib
, buildPythonApplication
, fetchFromGitHub
, fetchpatch
# python requirements
, beautifulsoup4
, boto3
, faker
, fonttools
, h5py
, importlib-metadata
, lxml
, matplotlib
, numpy
, odfpy
, openpyxl
, pandas
, pdfminer-six
, praw
, psutil
, psycopg2
, pyarrow
, pyshp
, pypng
, python-dateutil
, pyyaml
, requests
, seaborn
, setuptools
, sh
, tabulate
, urllib3
, vobject
, wcwidth
, xlrd
, xlwt
, zstandard
, zulip
# other
, git
, withPcap ? true, dpkt, dnslib
, withXclip ? stdenv.isLinux, xclip
, testers
, visidata
}:
buildPythonApplication rec {
pname = "visidata";
version = "3.0.2";
src = fetchFromGitHub {
owner = "saulpw";
repo = "visidata";
rev = "v${version}";
hash = "sha256-gplrkrFTIP6TLvk1YazD5roDzsPvDtOXLlTOmTio52s=";
};
patches = [
# Drop when next release is out
(fetchpatch {
name = "drop-support-for-python-37.patch";
url = "https://github.com/saulpw/visidata/commit/738bb8b43814c14b1b8a1f1f60397c1520c5ef4a.patch";
hash = "sha256-5jDAzKMuW3s7BCGpWyLcS4Lw8GUbjNxVhF5mUKbR1YY=";
})
(fetchpatch {
name = "update-tests-for-python-312.patch";
url = "https://github.com/saulpw/visidata/commit/627f6f126cdd49bcdda0bbc16fab42eb5bd42103.patch";
hash = "sha256-3FHgjLrzMHObEheJoRY8VlnDUtDZ68FqCqAyhP7333E=";
})
];
propagatedBuildInputs = [
# from visidata/requirements.txt
# packages not (yet) present in nixpkgs are commented
python-dateutil
pandas
requests
lxml
openpyxl
xlrd
xlwt
h5py
psycopg2
boto3
pyshp
#mapbox-vector-tile
pypng
#pyconll
fonttools
#sas7bdat
#xport
#savReaderWriter
pyyaml
#namestand
#datapackage
pdfminer-six
#tabula
vobject
tabulate
wcwidth
zstandard
odfpy
urllib3
pyarrow
seaborn
matplotlib
sh
psutil
numpy
#requests_cache
beautifulsoup4
faker
praw
zulip
#pyairtable
setuptools
importlib-metadata
] ++ lib.optionals withPcap [ dpkt dnslib ]
++ lib.optional withXclip xclip;
nativeCheckInputs = [
git
];
# check phase uses the output bin, which is not possible when cross-compiling
doCheck = stdenv.buildPlatform == stdenv.hostPlatform;
checkPhase = ''
runHook preCheck
# disable some tests which require access to the network
rm -f tests/load-http.vd # http
rm -f tests/graph-cursor-nosave.vd # http
rm -f tests/messenger-nosave.vd # dns
# tests to disable because we don't have a package to load such files
rm -f tests/load-conllu.vdj # no 'pyconll'
rm -f tests/load-sav.vd # no 'savReaderWriter'
# tests use git to compare outputs to references
git init -b "test-reference"
git config user.name "nobody"
git config user.email "no@where"
git add .
git commit -m "test reference"
substituteInPlace dev/test.sh --replace "bin/vd" "$out/bin/vd"
bash dev/test.sh
runHook postCheck
'';
postInstall = ''
python dev/zsh-completion.py
install -Dm644 _visidata -t $out/share/zsh/site-functions
'';
pythonImportsCheck = ["visidata"];
passthru.tests.version = testers.testVersion {
package = visidata;
version = "v${version}";
};
meta = {
description = "Interactive terminal multitool for tabular data";
license = lib.licenses.gpl3;
maintainers = with lib.maintainers; [ raskin markus1189 ];
homepage = "https://visidata.org/";
changelog = "https://github.com/saulpw/visidata/blob/v${version}/CHANGELOG.md";
};
}
|