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