summary refs log tree commit diff
path: root/pkgs/development/python-modules/cmd2/old.nix
blob: c6ee1eaf8bc0cbb8f91754cb2b83c9ef49c175a3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
{ stdenv, buildPythonPackage, pythonOlder
, pyperclip, six, pyparsing, vim
, contextlib2 ? null, subprocess32 ? null
, pytest, mock, which, fetchFromGitHub, glibcLocales
}:
buildPythonPackage rec {
  pname = "cmd2";
  version = "0.8.0";

  src = fetchFromGitHub {
    owner = "python-cmd2";
    repo = "cmd2";
    rev = version;
    sha256 = "0nw2b7n7zg51bc3glxw0l9fn91mwjnjshklhmxhyvjbsg7khf64z";
  };

  LC_ALL="en_US.UTF-8";

  postPatch = stdenv.lib.optional 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
  '';

  checkInputs= [ pytest mock which vim glibcLocales ];
  checkPhase = ''
    # test_path_completion_user_expansion might be fixed in the next release
    py.test -k 'not test_path_completion_user_expansion'
  '';
  doCheck = !stdenv.isDarwin;

  propagatedBuildInputs = [
    pyperclip
    six
    pyparsing
  ]
  ++ stdenv.lib.optional (pythonOlder "3.5") contextlib2
  ++ stdenv.lib.optional (pythonOlder "3.0") subprocess32
  ;

  meta = with stdenv.lib; {
    description = "Enhancements for standard library's cmd module";
    homepage = https://github.com/python-cmd2/cmd2;
    maintainers = with maintainers; [ teto ];
  };
}