1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 antlr4,
6 antlr4-python3-runtime,
7 igraph,
8 pygments,
9 pytestCheckHook,
10 pythonRelaxDepsHook,
11 setuptools,
12}:
13
14buildPythonPackage rec {
15 pname = "explorerscript";
16 version = "0.1.5";
17 pyproject = true;
18
19 src = fetchFromGitHub {
20 owner = "SkyTemple";
21 repo = pname;
22 rev = version;
23 hash = "sha256-dGbzZYEFEWE5bUz+647pPzP4Z/XmrJU82jNT4ZBRNHk=";
24 };
25
26 nativeBuildInputs = [
27 antlr4
28 pythonRelaxDepsHook
29 setuptools
30 ];
31
32 pythonRelaxDeps = [
33 # antlr output is rebuilt in postPatch step.
34 "antlr4-python3-runtime"
35 # igraph > 0.10.4 was marked as incompatible by upstream
36 # due to a breaking change introduced in 0.10.5. Later versions reverted
37 # this change, and introduced a deprecation warning instead.
38 #
39 # https://github.com/igraph/python-igraph/issues/693
40 "igraph"
41 ];
42
43 postPatch = ''
44 antlr -Dlanguage=Python3 -visitor explorerscript/antlr/{ExplorerScript,SsbScript}.g4
45 '';
46
47 propagatedBuildInputs = [
48 antlr4-python3-runtime
49 igraph
50 ];
51
52 passthru.optional-dependencies.pygments = [ pygments ];
53
54 nativeCheckInputs = [ pytestCheckHook ] ++ passthru.optional-dependencies.pygments;
55
56 pythonImportsCheck = [ "explorerscript" ];
57
58 meta = with lib; {
59 homepage = "https://github.com/SkyTemple/explorerscript";
60 description = "A programming language + compiler/decompiler for creating scripts for Pokémon Mystery Dungeon Explorers of Sky";
61 license = licenses.mit;
62 maintainers = with maintainers; [ marius851000 ];
63 };
64}