1{ stdenv, buildPythonPackage, pythonOlder
2, pyperclip, six, pyparsing, vim
3, contextlib2 ? null, subprocess32 ? null
4, pytest, mock, which, fetchFromGitHub, glibcLocales
5, runtimeShell
6}:
7buildPythonPackage rec {
8 pname = "cmd2";
9 version = "0.8.0";
10
11 src = fetchFromGitHub {
12 owner = "python-cmd2";
13 repo = "cmd2";
14 rev = version;
15 sha256 = "0nw2b7n7zg51bc3glxw0l9fn91mwjnjshklhmxhyvjbsg7khf64z";
16 };
17
18 LC_ALL="en_US.UTF-8";
19
20 postPatch = stdenv.lib.optional stdenv.isDarwin ''
21 # Fake the impure dependencies pbpaste and pbcopy
22 mkdir bin
23 echo '#${runtimeShell}' > bin/pbpaste
24 echo '#${runtimeShell}' > bin/pbcopy
25 chmod +x bin/{pbcopy,pbpaste}
26 export PATH=$(realpath bin):$PATH
27 '';
28
29 checkInputs= [ pytest mock which vim glibcLocales ];
30 checkPhase = ''
31 # test_path_completion_user_expansion might be fixed in the next release
32 py.test -k 'not test_path_completion_user_expansion'
33 '';
34 doCheck = !stdenv.isDarwin;
35
36 propagatedBuildInputs = [
37 pyperclip
38 six
39 pyparsing
40 ]
41 ++ stdenv.lib.optional (pythonOlder "3.5") contextlib2
42 ++ stdenv.lib.optional (pythonOlder "3.0") subprocess32
43 ;
44
45 meta = with stdenv.lib; {
46 description = "Enhancements for standard library's cmd module";
47 homepage = https://github.com/python-cmd2/cmd2;
48 maintainers = with maintainers; [ teto ];
49 };
50}