1{ lib
2, stdenv
3, attrs
4, buildPythonPackage
5, colorama
6, fetchPypi
7, glibcLocales
8, importlib-metadata
9, pyperclip
10, pytest-mock
11, pytestCheckHook
12, pythonOlder
13, setuptools-scm
14, typing-extensions
15, vim
16, wcwidth
17}:
18
19buildPythonPackage rec {
20 pname = "cmd2";
21 version = "2.2.0";
22
23 disabled = pythonOlder "3.6";
24
25 src = fetchPypi {
26 inherit pname version;
27 sha256 = "34cd12424d9e2835eff125146af3d9f4a4c2931c6bc5a3cea9790bd4f55756d9";
28 };
29
30 LC_ALL = "en_US.UTF-8";
31
32 buildInputs = [
33 setuptools-scm
34 ];
35
36 propagatedBuildInputs = [
37 attrs
38 colorama
39 pyperclip
40 wcwidth
41 ] ++ lib.optionals (pythonOlder "3.8") [
42 typing-extensions
43 importlib-metadata
44 ];
45
46 checkInputs = [
47 pytestCheckHook
48 glibcLocales
49 pytest-mock
50 vim
51 ];
52
53 postPatch = ''
54 sed -i "/--cov/d" setup.cfg
55 '' + lib.optionalString stdenv.isDarwin ''
56 # Fake the impure dependencies pbpaste and pbcopy
57 mkdir bin
58 echo '#!${stdenv.shell}' > bin/pbpaste
59 echo '#!${stdenv.shell}' > bin/pbcopy
60 chmod +x bin/{pbcopy,pbpaste}
61 export PATH=$(realpath bin):$PATH
62 '';
63
64 doCheck = !stdenv.isDarwin;
65
66 pythonImportsCheck = [ "cmd2" ];
67
68 meta = with lib; {
69 description = "Enhancements for standard library's cmd module";
70 homepage = "https://github.com/python-cmd2/cmd2";
71 license = with licenses; [ mit ];
72 maintainers = with maintainers; [ teto ];
73 };
74}