1{ stdenv, buildPythonPackage, fetchPypi, fetchpatch, python, coverage, lsof, glibcLocales }:
2
3buildPythonPackage rec {
4 pname = "sh";
5 version = "1.12.14";
6
7 src = fetchPypi {
8 inherit pname version;
9 sha256 = "1z2hx357xp3v4cv44xmqp7lli3frndqpyfmpbxf7n76h7s1zaaxm";
10 };
11
12 patches = [
13 # Disable tests that fail on Darwin
14 # Some of the failures are due to Nix using GNU coreutils
15 ./disable-broken-tests-darwin.patch
16 # Fix tests for Python 3.7. See: https://github.com/amoffat/sh/pull/468
17 (fetchpatch {
18 url = "https://github.com/amoffat/sh/commit/b6202f75706473f02084d819e0765056afa43664.patch";
19 sha256 = "1kzxyxcc88zhgn2kmfg9yrbs4n405b2jq7qykb453l52hy10vi94";
20 excludes = [ ".travis.yml" ];
21 })
22 ];
23
24 postPatch = ''
25 sed -i 's#/usr/bin/env python#${python.interpreter}#' test.py
26 '';
27
28 checkInputs = [ coverage lsof glibcLocales ];
29
30 # A test needs the HOME directory to be different from $TMPDIR.
31 preCheck = ''
32 export LC_ALL="en_US.UTF-8"
33 HOME=$(mktemp -d)
34 '';
35
36 meta = {
37 description = "Python subprocess interface";
38 homepage = https://pypi.python.org/pypi/sh/;
39 license = stdenv.lib.licenses.mit;
40 };
41}