1{
2 lib,
3 appdirs,
4 argparse,
5 buildPythonPackage,
6 doit,
7 fetchPypi,
8 ftfy,
9 mock,
10 pyinstaller-versionfile,
11 pytest-order,
12 pytestCheckHook,
13 python,
14 pythonOlder,
15 requests,
16 setuptools,
17 setuptools-scm,
18 tableauserverclient,
19 types-appdirs,
20 types-mock,
21 types-requests,
22 types-setuptools,
23 urllib3,
24}:
25
26buildPythonPackage rec {
27 pname = "tabcmd";
28 version = "2.0.18";
29 pyproject = true;
30
31 disabled = pythonOlder "3.7";
32
33 src = fetchPypi {
34 inherit pname version;
35 hash = "sha256-erGngJ3CW+c3PuVq4BTrPGSZ2L/M0EykSoZocku0lOE=";
36 };
37
38 prePatch = ''
39 # Remove an unneeded dependency that can't be resolved
40 # https://github.com/tableau/tabcmd/pull/282
41 sed -i "/'argparse',/d" pyproject.toml
42 '';
43
44 pythonRelaxDeps = [
45 "tableauserverclient"
46 "urllib3"
47 ];
48
49 build-system = [ setuptools ];
50
51 dependencies = [
52 appdirs
53 argparse
54 doit
55 ftfy
56 pyinstaller-versionfile
57 requests
58 setuptools-scm
59 tableauserverclient
60 types-appdirs
61 types-mock
62 types-requests
63 types-setuptools
64 urllib3
65 ];
66
67 nativeCheckInputs = [
68 mock
69 pytest-order
70 pytestCheckHook
71 ];
72
73 # Create a "tabcmd" executable
74 postInstall = ''
75 # Create a directory for our wrapped binary.
76 mkdir -p $out/bin
77
78 cp -r build/lib/tabcmd/__main__.py $out/bin/
79
80 # Create a 'tabcmd' script with python3 shebang
81 echo "#!${python.interpreter}" > $out/bin/tabcmd
82
83 # Append __main__.py contents
84 cat $out/bin/__main__.py >> $out/bin/tabcmd
85
86 # Make it executable.
87 chmod +x $out/bin/tabcmd
88 '';
89
90 pythonImportsCheck = [ "tabcmd" ];
91
92 meta = with lib; {
93 description = "Command line client for working with Tableau Server";
94 homepage = "https://github.com/tableau/tabcmd";
95 changelog = "https://github.com/tableau/tabcmd/releases/tag/v${version}";
96 license = licenses.mit;
97 maintainers = [ ];
98 mainProgram = "tabcmd";
99 };
100}