about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/typed-ast/default.nix
blob: c4977ab082925a34db47d7b0e883dfb9abee290b (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
50
{ lib
, buildPythonPackage
, fetchFromGitHub
, pytest
, pythonOlder
}:

buildPythonPackage rec {
  pname = "typed-ast";
  version = "1.5.1";
  format = "setuptools";

  disabled = pythonOlder "3.6";

  src = fetchFromGitHub {
    owner = "python";
    repo = "typed_ast";
    rev = version;
    hash = "sha256-qfXMT+rSf/WcWHpkg4VZXZMYj/5IKQWAKRsxQ0TRzPU=";
  };

  checkInputs = [
    pytest
  ];

  checkPhase = ''
    runHook preCheck

    # We can't use pytestCheckHook because that invokes pytest with python -m pytest
    # which adds the current directory to sys.path at the beginning.
    # _That_ version of the typed_ast module doesn't have the C extensions we need.
    pytest

    runHook postCheck
  '';

  pythonImportsCheck = [
    "typed_ast"
    "typed_ast.ast27"
    "typed_ast.ast3"
    "typed_ast.conversions"
  ];

  meta = with lib; {
    description = "Python AST modules with type comment support";
    homepage = "https://github.com/python/typed_ast";
    license = licenses.asl20;
    maintainers = with maintainers; [ SuperSandro2000 ];
  };
}