1{ lib, stdenv, buildPythonPackage, fetchPypi, python, coverage, lsof, glibcLocales, coreutils, pytestCheckHook }:
2
3buildPythonPackage rec {
4 pname = "sh";
5 version = "1.14.3";
6
7 src = fetchPypi {
8 inherit pname version;
9 sha256 = "sha256-5ARbbHMtnOddVxx59awiNO3Zrk9fqdWbCXBQgr3KGMc=";
10 };
11
12 postPatch = ''
13 sed -i 's#/usr/bin/env python#${python.interpreter}#' test.py
14 sed -i 's#/bin/sleep#${coreutils.outPath}/bin/sleep#' test.py
15 '';
16
17 checkInputs = [ coverage lsof glibcLocales pytestCheckHook ];
18
19 # A test needs the HOME directory to be different from $TMPDIR.
20 preCheck = ''
21 export LC_ALL="en_US.UTF-8"
22 HOME=$(mktemp -d)
23 '';
24
25 pytestFlagsArray = [ "test.py" ];
26
27 disabledTests = [
28 # Disable tests that fail on Hydra
29 "test_no_fd_leak"
30 "test_piped_exception1"
31 "test_piped_exception2"
32 "test_unicode_path"
33 ] ++ lib.optionals stdenv.isDarwin [
34 # Disable tests that fail on Darwin sandbox
35 "test_background_exception"
36 "test_cwd"
37 "test_ok_code"
38 ];
39
40 meta = with lib; {
41 description = "Python subprocess interface";
42 homepage = "https://pypi.python.org/pypi/sh/";
43 license = licenses.mit;
44 maintainers = with maintainers; [ siriobalmelli ];
45 };
46}