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