about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/cmd2/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/python-modules/cmd2/default.nix')
-rw-r--r--nixpkgs/pkgs/development/python-modules/cmd2/default.nix80
1 files changed, 47 insertions, 33 deletions
diff --git a/nixpkgs/pkgs/development/python-modules/cmd2/default.nix b/nixpkgs/pkgs/development/python-modules/cmd2/default.nix
index b5bbc88c341f..f74cf77c5e4a 100644
--- a/nixpkgs/pkgs/development/python-modules/cmd2/default.nix
+++ b/nixpkgs/pkgs/development/python-modules/cmd2/default.nix
@@ -1,60 +1,74 @@
-{ 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 = "1.5.0";
+  version = "2.1.2";
+
+  disabled = pythonOlder "3.6";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "701a8c9975c4abc45e5d13906ab149f959f812869106347323a3f89ac0e82a62";
+    sha256 = "25dbb2e9847aaa686a8a21e84e3d101db8b79f5cb992e044fc54210ab8c0ad41";
   };
 
-  LC_ALL="en_US.UTF-8";
-
-  postPatch = lib.optionalString stdenv.isDarwin ''
-    # Fake the impure dependencies pbpaste and pbcopy
-    mkdir bin
-    echo '#!${stdenv.shell}' > bin/pbpaste
-    echo '#!${stdenv.shell}' > bin/pbcopy
-    chmod +x bin/{pbcopy,pbpaste}
-    export PATH=$(realpath bin):$PATH
-  '';
-
-  disabled = !isPy3k;
+  LC_ALL = "en_US.UTF-8";
 
   buildInputs = [
     setuptools-scm
   ];
 
   propagatedBuildInputs = [
+    attrs
     colorama
     pyperclip
-    six
-    pyparsing
     wcwidth
-    attrs
-  ]
-  ++ lib.optionals (pythonOlder "3.5") [contextlib2 typing]
-  ;
+  ] ++ lib.optionals (pythonOlder "3.8") [
+    typing-extensions
+    importlib-metadata
+  ];
 
+  checkInputs = [
+    pytestCheckHook
+    glibcLocales
+    pytest-mock
+    vim
+  ];
 
-  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'
+  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
+    echo '#!${stdenv.shell}' > bin/pbcopy
+    chmod +x bin/{pbcopy,pbpaste}
+    export PATH=$(realpath bin):$PATH
   '';
 
+  doCheck = !stdenv.isDarwin;
+
+  pythonImportsCheck = [ "cmd2" ];
+
   meta = with lib; {
     description = "Enhancements for standard library's cmd module";
     homepage = "https://github.com/python-cmd2/cmd2";
+    license = with licenses; [ mit ];
     maintainers = with maintainers; [ teto ];
   };
 }