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