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