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