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 # Many tests want to open network connections
61 # https://github.com/cea-hpc/clustershell#test-suite
62 #
63 # Several tests fail on Darwin
64 checkPhase = ''
65 rm tests/CLIClushTest.py
66 rm tests/TreeWorkerTest.py
67 rm tests/TaskDistantMixin.py
68 rm tests/TaskDistantTest.py
69 rm tests/TaskDistantPdshMixin.py
70 rm tests/TaskDistantPdshTest.py
71 rm tests/TaskRLimitsTest.py
72
73 nosetests -v \
74 -e test_channel_ctl_shell_remote1 \
75 -e test_channel_ctl_shell_remote2 \
76 -e test_fromall_grouplist \
77 -e test_rank_placeholder \
78 -e test_engine_on_the_fly_launch \
79 -e test_ev_pickup_fanout \
80 -e test_ev_pickup_fanout_legacy \
81 -e test_timeout \
82 -e test_008_broken_pipe_on_write \
83 -e testLocalBufferRCGathering \
84 -e testLocalBuffers \
85 -e testLocalErrorBuffers \
86 -e testLocalFanout \
87 -e testLocalRetcodes \
88 -e testLocalRCBufferGathering \
89 -e testLocalSingleLineBuffers \
90 -e testLocalWorkerFanout \
91 -e testSimpleMultipleCommands \
92 -e testClushConfigSetRlimit \
93 -e testTimerInvalidateInHandler \
94 -e testTimerSetNextFireInHandler \
95 -e test_channel_ctl_shell_mlocal1 \
96 -e test_channel_ctl_shell_mlocal2 \
97 -e test_channel_ctl_shell_mlocal3 \
98 -e test_node_placeholder \
99 tests/*.py
100 '';
101
102 meta = with lib; {
103 broken = stdenv.isDarwin;
104 description = "Scalable Python framework for cluster administration";
105 homepage = "https://cea-hpc.github.io/clustershell";
106 license = licenses.lgpl21;
107 maintainers = [ maintainers.alexvorobiev ];
108 };
109}