1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, pytestCheckHook
5, pythonAtLeast
6, pythonOlder
7, setuptools
8, setuptools-scm
9}:
10
11buildPythonPackage rec {
12 pname = "pegen";
13 version = "0.3.0";
14 format = "pyproject";
15
16 disabled = pythonOlder "3.8";
17
18 src = fetchFromGitHub {
19 owner = "we-like-parsers";
20 repo = pname;
21 rev = "refs/tags/v${version}";
22 hash = "sha256-P4zX8za9lBlXhNPkQe9p136ggZEJh6fHfBr+DQKvtTg=";
23 };
24
25 SETUPTOOLS_SCM_PRETEND_VERSION = version;
26
27 nativeBuildInputs = [
28 setuptools
29 setuptools-scm
30 ];
31
32 nativeCheckInputs = [
33 pytestCheckHook
34 ];
35
36 pythonImportsCheck = [
37 "pegen"
38 ];
39
40 disabledTests = 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}