1{
2 stdenv,
3 lib,
4 buildPythonPackage,
5 fetchPypi,
6 pyyaml,
7 openssh,
8 nose,
9 bc,
10 hostname,
11 bash,
12}:
13
14buildPythonPackage rec {
15 pname = "clustershell";
16 version = "1.9.2";
17
18 src = fetchPypi {
19 pname = "ClusterShell";
20 inherit version;
21 hash = "sha256-rsF/HG4GNBC+N49b+sDO2AyUI1G44wJNBUwQNPzShD0=";
22 };
23
24 postPatch = ''
25 substituteInPlace lib/ClusterShell/Worker/Ssh.py \
26 --replace '"ssh"' '"${openssh}/bin/ssh"' \
27 --replace '"scp"' '"${openssh}/bin/scp"'
28
29 substituteInPlace lib/ClusterShell/Worker/fastsubprocess.py \
30 --replace '"/bin/sh"' '"${bash}/bin/sh"'
31
32 for f in tests/*; do
33 substituteInPlace $f \
34 --replace '/bin/hostname' '${hostname}/bin/hostname' \
35 --replace '/bin/sleep' 'sleep' \
36 --replace '/bin/echo' 'echo' \
37 --replace '/bin/uname' 'uname' \
38 --replace '/bin/false' 'false' \
39 --replace '/bin/true' 'true' \
40 --replace '/usr/bin/printf' 'printf'
41 done
42
43 # Fix warnings
44 substituteInPlace lib/ClusterShell/Task.py \
45 --replace "notifyAll" "notify_all"
46 substituteInPlace tests/TaskPortTest.py lib/ClusterShell/Task.py \
47 --replace "currentThread" "current_thread"
48 '';
49
50 propagatedBuildInputs = [ pyyaml ];
51
52 nativeCheckInputs = [
53 bc
54 hostname
55 nose
56 ];
57
58 pythonImportsCheck = [ "ClusterShell" ];
59
60 doCheck = false; # tests often get stuck
61
62 # Many tests want to open network connections
63 # https://github.com/cea-hpc/clustershell#test-suite
64 #
65 # Several tests fail on Darwin
66 checkPhase = ''
67 rm tests/CLIClushTest.py
68 rm tests/TreeWorkerTest.py
69 rm tests/TaskDistantMixin.py
70 rm tests/TaskDistantTest.py
71 rm tests/TaskDistantPdshMixin.py
72 rm tests/TaskDistantPdshTest.py
73 rm tests/TaskRLimitsTest.py
74 rm tests/TreeGatewayTest.py
75
76 nosetests -v \
77 -e test_fromall_grouplist \
78 -e test_rank_placeholder \
79 -e test_engine_on_the_fly_launch \
80 -e test_ev_pickup_fanout \
81 -e test_ev_pickup_fanout_legacy \
82 -e test_timeout \
83 -e test_008_broken_pipe_on_write \
84 -e testLocalBufferRCGathering \
85 -e testLocalBuffers \
86 -e testLocalErrorBuffers \
87 -e testLocalFanout \
88 -e testLocalRetcodes \
89 -e testLocalRCBufferGathering \
90 -e testLocalSingleLineBuffers \
91 -e testLocalWorkerFanout \
92 -e testSimpleMultipleCommands \
93 -e testClushConfigSetRlimit \
94 -e testTimerInvalidateInHandler \
95 -e testTimerSetNextFireInHandler \
96 -e test_node_placeholder \
97 tests/*.py
98 '';
99
100 meta = with lib; {
101 broken = stdenv.isDarwin;
102 description = "Scalable Python framework for cluster administration";
103 homepage = "https://cea-hpc.github.io/clustershell";
104 license = licenses.lgpl21;
105 maintainers = [ maintainers.alexvorobiev ];
106 };
107}