1{ 2 stdenv, 3 lib, 4 buildPythonPackage, 5 fetchPypi, 6 setuptools, 7 distutils, 8 pyyaml, 9 openssh, 10 unittestCheckHook, 11 installShellFiles, 12 bc, 13 hostname, 14 bash, 15}: 16 17buildPythonPackage rec { 18 pname = "clustershell"; 19 version = "1.9.3"; 20 pyproject = true; 21 22 src = fetchPypi { 23 pname = "ClusterShell"; 24 inherit version; 25 hash = "sha256-4oTA5rP+CgzWvmffcd+/aqMhGIlz22g6BX9WN1UvvIw="; 26 }; 27 28 build-system = [ 29 setuptools 30 distutils 31 ]; 32 33 postPatch = '' 34 substituteInPlace lib/ClusterShell/Worker/Ssh.py \ 35 --replace-fail '"ssh"' '"${openssh}/bin/ssh"' \ 36 --replace-fail '"scp"' '"${openssh}/bin/scp"' 37 38 substituteInPlace lib/ClusterShell/Worker/fastsubprocess.py \ 39 --replace-fail '"/bin/sh"' '"${bash}/bin/sh"' 40 41 for f in tests/*; do 42 substituteInPlace $f \ 43 --replace-quiet '/bin/hostname' '${hostname}/bin/hostname' \ 44 --replace-quiet '/bin/sleep' 'sleep' \ 45 --replace-quiet '/bin/echo' 'echo' \ 46 --replace-quiet '/bin/uname' 'uname' \ 47 --replace-quiet '/bin/false' 'false' \ 48 --replace-quiet '/bin/true' 'true' \ 49 --replace-quiet '/usr/bin/printf' 'printf' 50 done 51 ''; 52 53 propagatedBuildInputs = [ pyyaml ]; 54 55 nativeBuildInputs = [ installShellFiles ]; 56 57 nativeCheckInputs = [ 58 bc 59 hostname 60 unittestCheckHook 61 ]; 62 63 pythonImportsCheck = [ "ClusterShell" ]; 64 65 unittestFlagsArray = [ 66 "tests" 67 "-p" 68 "'*Test.py'" 69 ]; 70 71 # Many tests want to open network connections 72 # https://github.com/cea-hpc/clustershell#test-suite 73 # 74 # Several tests fail on Darwin 75 preCheck = '' 76 rm tests/CLIClushTest.py 77 rm tests/TreeWorkerTest.py 78 rm tests/TaskDistantMixin.py 79 rm tests/TaskDistantTest.py 80 rm tests/TaskDistantPdshMixin.py 81 rm tests/TaskDistantPdshTest.py 82 rm tests/TaskRLimitsTest.py 83 rm tests/TreeGatewayTest.py 84 ''; 85 86 postInstall = '' 87 installShellCompletion --bash bash_completion.d/* 88 ''; 89 90 meta = with lib; { 91 broken = stdenv.hostPlatform.isDarwin; 92 description = "Scalable Python framework for cluster administration"; 93 homepage = "https://cea-hpc.github.io/clustershell"; 94 license = licenses.lgpl21; 95 maintainers = [ maintainers.alexvorobiev ]; 96 }; 97}