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