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