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