1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pytestCheckHook,
6 pythonAtLeast,
7 pythonOlder,
8 setuptools,
9 setuptools-scm,
10}:
11
12buildPythonPackage rec {
13 pname = "pegen";
14 version = "0.3.0";
15 format = "pyproject";
16
17 disabled = pythonOlder "3.8";
18
19 src = fetchFromGitHub {
20 owner = "we-like-parsers";
21 repo = pname;
22 rev = "refs/tags/v${version}";
23 hash = "sha256-P4zX8za9lBlXhNPkQe9p136ggZEJh6fHfBr+DQKvtTg=";
24 };
25
26 nativeBuildInputs = [
27 setuptools
28 setuptools-scm
29 ];
30
31 nativeCheckInputs = [ pytestCheckHook ];
32
33 pythonImportsCheck = [ "pegen" ];
34
35 disabledTests =
36 [
37 # ValueError: Expected locations of (1, 3) and...
38 "test_invalid_call_arguments"
39 ]
40 ++ lib.optionals (pythonAtLeast "3.11") [
41 # https://github.com/we-like-parsers/pegen/issues/89
42 "test_invalid_def_stmt"
43 ];
44
45 meta = with lib; {
46 description = "Library to generate PEG parsers";
47 homepage = "https://github.com/we-like-parsers/pegen";
48 changelog = "https://github.com/we-like-parsers/pegen/releases/tag/v${version}";
49 license = licenses.mit;
50 maintainers = with maintainers; [ fab ];
51 };
52}