From 070e765d0aaa3b5e30c85130a6eb9442ac53a488 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Wed, 1 Sep 2021 14:11:09 +0200 Subject: [PATCH] python3Packages.cmd2: fix build --- .../python-modules/cmd2/default.nix | 79 +++++++++++-------- 1 file changed, 46 insertions(+), 33 deletions(-) diff --git a/pkgs/development/python-modules/cmd2/default.nix b/pkgs/development/python-modules/cmd2/default.nix index f330a309ebf6..7d979d1f0216 100644 --- a/pkgs/development/python-modules/cmd2/default.nix +++ b/pkgs/development/python-modules/cmd2/default.nix @@ -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";