Merge pull request #185381 from onny/clustershell

This commit is contained in:
Sandro 2022-08-07 22:55:42 +02:00 committed by GitHub
commit 04053f8228
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,5 +1,13 @@
{ stdenv, lib, buildPythonPackage, fetchPypi, pyyaml, openssh
, nose, bc, hostname, coreutils, bash, gnused
{ stdenv
, lib
, buildPythonPackage
, fetchPypi
, pyyaml
, openssh
, nose
, bc
, hostname
, bash
}:
buildPythonPackage rec {
@ -11,8 +19,6 @@ buildPythonPackage rec {
sha256 = "ff6fba688a06e5e577315d899f0dab3f4fe479cef99d444a4e651af577b7d081";
};
propagatedBuildInputs = [ pyyaml ];
postPatch = ''
substituteInPlace lib/ClusterShell/Worker/Ssh.py \
--replace '"ssh"' '"${openssh}/bin/ssh"' \
@ -20,29 +26,40 @@ buildPythonPackage rec {
substituteInPlace lib/ClusterShell/Worker/fastsubprocess.py \
--replace '"/bin/sh"' '"${bash}/bin/sh"'
for f in tests/*; do
substituteInPlace $f \
--replace '/bin/hostname' '${hostname}/bin/hostname' \
--replace '/bin/sleep' 'sleep' \
--replace '/bin/echo' 'echo' \
--replace '/bin/uname' 'uname' \
--replace '/bin/false' 'false' \
--replace '/bin/true' 'true' \
--replace '/usr/bin/printf' 'printf'
done
# Fix warnings
substituteInPlace lib/ClusterShell/Task.py \
--replace "notifyAll" "notify_all"
substituteInPlace tests/TaskPortTest.py lib/ClusterShell/Task.py \
--replace "currentThread" "current_thread"
'';
checkInputs = [ nose bc hostname coreutils gnused ];
propagatedBuildInputs = [ pyyaml ];
checkInputs = [
bc
hostname
nose
];
pythonImportsCheck = [ "ClusterShell" ];
# Many tests want to open network connections
# https://github.com/cea-hpc/clustershell#test-suite
#
# Several tests fail on Darwin
checkPhase = ''
for f in tests/*; do
substituteInPlace $f \
--replace '/bin/hostname' '${hostname}/bin/hostname' \
--replace '/bin/sleep' '${coreutils}/bin/sleep' \
--replace '"sleep' '"${coreutils}/bin/sleep' \
--replace '/bin/echo' '${coreutils}/bin/echo' \
--replace '/bin/uname' '${coreutils}/bin/uname' \
--replace '/bin/false' '${coreutils}/bin/false' \
--replace '/bin/true' '${coreutils}/bin/true' \
--replace '/usr/bin/printf' '${coreutils}/bin/printf' \
--replace '"sed' '"${gnused}/bin/sed' \
--replace ' sed ' ' ${gnused}/bin/sed '
done
rm tests/CLIClushTest.py
rm tests/TreeWorkerTest.py
rm tests/TaskDistantMixin.py