2021-01-11 07:54:33 +00:00
|
|
|
{ lib, stdenv, fetchPypi, buildPythonPackage, pythonOlder, isPy3k
|
2019-01-18 11:01:06 +00:00
|
|
|
, pyperclip, six, pyparsing, vim, wcwidth, colorama, attrs
|
2018-10-15 11:10:30 +01:00
|
|
|
, contextlib2 ? null, typing ? null, setuptools_scm
|
|
|
|
, pytest, mock ? null, pytest-mock
|
|
|
|
, which, glibcLocales
|
2018-02-28 13:55:02 +00:00
|
|
|
}:
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "cmd2";
|
2021-02-03 05:41:12 +00:00
|
|
|
version = "1.5.0";
|
2018-02-28 13:55:02 +00:00
|
|
|
|
2018-06-14 02:25:58 +01:00
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2021-02-03 05:41:12 +00:00
|
|
|
sha256 = "701a8c9975c4abc45e5d13906ab149f959f812869106347323a3f89ac0e82a62";
|
2018-02-28 13:55:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
LC_ALL="en_US.UTF-8";
|
|
|
|
|
2021-01-24 00:29:22 +00:00
|
|
|
postPatch = lib.optional stdenv.isDarwin ''
|
2018-02-28 13:55:02 +00:00
|
|
|
# Fake the impure dependencies pbpaste and pbcopy
|
|
|
|
mkdir bin
|
2020-02-14 02:00:44 +00:00
|
|
|
echo '#!${stdenv.shell}' > bin/pbpaste
|
|
|
|
echo '#!${stdenv.shell}' > bin/pbcopy
|
2018-02-28 13:55:02 +00:00
|
|
|
chmod +x bin/{pbcopy,pbpaste}
|
|
|
|
export PATH=$(realpath bin):$PATH
|
|
|
|
'';
|
|
|
|
|
2018-06-14 02:25:58 +01:00
|
|
|
disabled = !isPy3k;
|
2018-02-28 13:55:02 +00:00
|
|
|
|
2018-08-30 18:12:47 +01:00
|
|
|
buildInputs = [
|
|
|
|
setuptools_scm
|
|
|
|
];
|
|
|
|
|
2018-02-28 13:55:02 +00:00
|
|
|
propagatedBuildInputs = [
|
2018-06-14 02:25:58 +01:00
|
|
|
colorama
|
2018-02-28 13:55:02 +00:00
|
|
|
pyperclip
|
|
|
|
six
|
|
|
|
pyparsing
|
2018-06-14 02:25:58 +01:00
|
|
|
wcwidth
|
2019-01-18 11:01:06 +00:00
|
|
|
attrs
|
2018-02-28 13:55:02 +00:00
|
|
|
]
|
2021-01-24 00:29:22 +00:00
|
|
|
++ lib.optionals (pythonOlder "3.5") [contextlib2 typing]
|
2018-02-28 13:55:02 +00:00
|
|
|
;
|
|
|
|
|
2018-10-15 11:10:30 +01:00
|
|
|
|
|
|
|
doCheck = !stdenv.isDarwin;
|
|
|
|
# pytest-cov
|
|
|
|
# argcomplete will generate errors
|
|
|
|
checkInputs= [ pytest mock which vim glibcLocales pytest-mock ]
|
2021-01-24 00:29:22 +00:00
|
|
|
++ lib.optional (pythonOlder "3.6") [ mock ];
|
2018-10-15 11:10:30 +01:00
|
|
|
checkPhase = ''
|
|
|
|
# test_path_completion_user_expansion might be fixed in the next release
|
|
|
|
py.test -k 'not test_path_completion_user_expansion'
|
|
|
|
'';
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2018-02-28 13:55:02 +00:00
|
|
|
description = "Enhancements for standard library's cmd module";
|
2020-04-06 14:18:39 +01:00
|
|
|
homepage = "https://github.com/python-cmd2/cmd2";
|
2018-02-28 13:55:02 +00:00
|
|
|
maintainers = with maintainers; [ teto ];
|
|
|
|
};
|
|
|
|
}
|