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