Merge pull request #119126 from fabaff/pycomfoconnect
[NixPkgs.git] / pkgs / development / python-modules / clustershell / default.nix
blobd247cecdfa63f492ed6fa0a08497d577e797f612
1 { lib, buildPythonPackage, fetchPypi, pyyaml, openssh
2 , nose, bc, hostname, coreutils, bash, gnused
3 }:
5 buildPythonPackage rec {
6   pname = "ClusterShell";
7   version = "1.8.3";
9   src = fetchPypi {
10     inherit pname version;
11     sha256 = "0ebc1925c1aed94f99d74cbc0230215127ade80a25240133204094faa74bc41b";
12   };
14   propagatedBuildInputs = [ pyyaml ];
16   postPatch = ''
17     substituteInPlace lib/ClusterShell/Worker/Ssh.py \
18       --replace '"ssh"' '"${openssh}/bin/ssh"' \
19       --replace '"scp"' '"${openssh}/bin/scp"'
21     substituteInPlace lib/ClusterShell/Worker/fastsubprocess.py \
22       --replace '"/bin/sh"' '"${bash}/bin/sh"'
23   '';
25   checkInputs = [ nose bc hostname coreutils gnused ];
27   # Many tests want to open network connections
28   # https://github.com/cea-hpc/clustershell#test-suite
29   #
30   # Several tests fail on Darwin
31   checkPhase = ''
32     for f in tests/*; do
33       substituteInPlace $f \
34         --replace '/bin/hostname'   '${hostname}/bin/hostname' \
35         --replace '/bin/sleep'      '${coreutils}/bin/sleep' \
36         --replace '"sleep'          '"${coreutils}/bin/sleep' \
37         --replace '/bin/echo'       '${coreutils}/bin/echo' \
38         --replace '/bin/uname'      '${coreutils}/bin/uname' \
39         --replace '/bin/false'      '${coreutils}/bin/false' \
40         --replace '/bin/true'       '${coreutils}/bin/true' \
41         --replace '/usr/bin/printf' '${coreutils}/bin/printf' \
42         --replace '"sed'            '"${gnused}/bin/sed' \
43         --replace ' sed '           ' ${gnused}/bin/sed '
44     done
46     rm tests/CLIClushTest.py
47     rm tests/TreeWorkerTest.py
48     rm tests/TaskDistantMixin.py
49     rm tests/TaskDistantTest.py
50     rm tests/TaskDistantPdshMixin.py
51     rm tests/TaskDistantPdshTest.py
52     rm tests/TaskRLimitsTest.py
54     nosetests -v \
55       -e test_channel_ctl_shell_remote1 \
56       -e test_channel_ctl_shell_remote2 \
57       -e test_fromall_grouplist \
58       -e test_rank_placeholder \
59       -e test_engine_on_the_fly_launch \
60       -e test_ev_pickup_fanout \
61       -e test_ev_pickup_fanout_legacy \
62       -e test_timeout \
63       -e test_008_broken_pipe_on_write \
64       -e testLocalBufferRCGathering \
65       -e testLocalBuffers \
66       -e testLocalErrorBuffers \
67       -e testLocalFanout \
68       -e testLocalRetcodes \
69       -e testLocalRCBufferGathering \
70       -e testLocalSingleLineBuffers \
71       -e testLocalWorkerFanout \
72       -e testSimpleMultipleCommands \
73       -e testClushConfigSetRlimit  \
74       -e testTimerInvalidateInHandler \
75       -e testTimerSetNextFireInHandler \
76       -e test_channel_ctl_shell_mlocal1 \
77       -e test_channel_ctl_shell_mlocal2 \
78       -e test_channel_ctl_shell_mlocal3 \
79       -e test_node_placeholder \
80     tests/*.py
81   '';
83   meta = with lib; {
84     description = "Scalable Python framework for cluster administration";
85     homepage = "https://cea-hpc.github.io/clustershell";
86     license = licenses.lgpl21;
87     maintainers = [ maintainers.alexvorobiev ];
88   };