1{ lib
2, buildPythonPackage
3, python3
4, pythonOlder
5, fetchPypi
6, ftfy
7, appdirs
8, requests
9, setuptools-scm
10, types-mock
11, types-appdirs
12, types-requests
13, types-setuptools
14, argparse
15, doit
16, pyinstaller-versionfile
17, tableauserverclient
18, pytestCheckHook
19, mock
20}:
21
22buildPythonPackage rec {
23 pname = "tabcmd";
24 version = "2.0.12";
25
26 disabled = pythonOlder "3.7";
27
28 src = fetchPypi {
29 inherit pname version;
30 sha256 = "sha256-nsQJWDzSzSc1WRk5TBl/E7Mpfk8wGD1CsETAWILKxCM=";
31 };
32
33 propagatedBuildInputs = [ ftfy appdirs requests setuptools-scm types-mock types-appdirs argparse doit pyinstaller-versionfile types-requests types-setuptools tableauserverclient ];
34
35 nativeCheckInputs = [ pytestCheckHook mock ];
36
37 # Remove an unneeded dependency that can't be resolved
38 prePatch = ''
39 sed -i "/'argparse',/d" pyproject.toml
40 '';
41
42 # Create a "tabcmd" executable
43 postInstall = ''
44 # Create a directory for our wrapped binary.
45 mkdir -p $out/bin
46
47 cp -r build/lib/tabcmd/__main__.py $out/bin/
48
49 # Create a 'tabcmd' script with python3 shebang
50 echo "#!${python3}/bin/python3" > $out/bin/tabcmd
51
52 # Append __main__.py contents
53 cat $out/bin/__main__.py >> $out/bin/tabcmd
54
55 # Make it executable.
56 chmod +x $out/bin/tabcmd
57 '';
58
59
60 meta = {
61 description = "A command line client for working with Tableau Server.";
62 homepage = "https://pypi.org/project/tabcmd/";
63 license = lib.licenses.mit;
64 maintainers = with lib.maintainers; [ ];
65 };
66}