python3Packages.cmd2: fix build

This commit is contained in:
Fabian Affolter 2021-09-01 14:11:09 +02:00 committed by Martin Weinelt
parent 167a7d9e23
commit 6256ef474f

View File

@ -1,21 +1,58 @@
{ lib, stdenv, fetchPypi, buildPythonPackage, pythonOlder, isPy3k
, pyperclip, six, pyparsing, vim, wcwidth, colorama, attrs
, contextlib2 ? null, typing ? null, setuptools-scm
, pytest, mock ? null, pytest-mock
, which, glibcLocales
{ lib
, stdenv
, attrs
, buildPythonPackage
, colorama
, fetchPypi
, glibcLocales
, importlib-metadata
, pyperclip
, pytest-mock
, pytestCheckHook
, pythonOlder
, setuptools-scm
, typing-extensions
, vim
, wcwidth
}:
buildPythonPackage rec {
pname = "cmd2";
version = "2.1.2";
disabled = pythonOlder "3.6";
src = fetchPypi {
inherit pname version;
sha256 = "25dbb2e9847aaa686a8a21e84e3d101db8b79f5cb992e044fc54210ab8c0ad41";
};
LC_ALL="en_US.UTF-8";
LC_ALL = "en_US.UTF-8";
postPatch = lib.optionalString stdenv.isDarwin ''
buildInputs = [
setuptools-scm
];
propagatedBuildInputs = [
attrs
colorama
pyperclip
wcwidth
] ++ lib.optionals (pythonOlder "3.8") [
typing-extensions
importlib-metadata
];
checkInputs = [
pytestCheckHook
glibcLocales
pytest-mock
vim
];
postPatch = ''
sed -i "/--cov/d" setup.cfg
'' + lib.optionalString stdenv.isDarwin ''
# Fake the impure dependencies pbpaste and pbcopy
mkdir bin
echo '#!${stdenv.shell}' > bin/pbpaste
@ -24,33 +61,9 @@ buildPythonPackage rec {
export PATH=$(realpath bin):$PATH
'';
disabled = !isPy3k;
buildInputs = [
setuptools-scm
];
propagatedBuildInputs = [
colorama
pyperclip
six
pyparsing
wcwidth
attrs
]
++ lib.optionals (pythonOlder "3.5") [contextlib2 typing]
;
doCheck = !stdenv.isDarwin;
# pytest-cov
# argcomplete will generate errors
checkInputs= [ pytest mock which vim glibcLocales pytest-mock ]
++ lib.optional (pythonOlder "3.6") [ mock ];
checkPhase = ''
# test_path_completion_user_expansion might be fixed in the next release
py.test -k 'not test_path_completion_user_expansion'
'';
pythonImportsCheck = [ "cmd2" ];
meta = with lib; {
description = "Enhancements for standard library's cmd module";