summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/explorerscript/default.nix
blob: 6f1b346274a2e1dab23de685dbf6318b74455405 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  igraph,
  pygments,
  scikit-build-core,
  pybind11,
  ninja,
  ruff,
  cmake,
  pytestCheckHook,
  setuptools,
}:

buildPythonPackage rec {
  pname = "explorerscript";
  version = "0.2.1.post2";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "SkyTemple";
    repo = pname;
    rev = version;
    hash = "sha256-cKEceWr7XmZbuomPOmjQ32ptAjz3LZDQBWAgZEFadDY=";
    # Include a pinned antlr4 fork used as a C++ library
    fetchSubmodules = true;
  };

  nativeBuildInputs = [
    setuptools
    scikit-build-core
    ninja
    cmake
    ruff
  ];

  # The source include some auto-generated ANTLR code that could be recompiled, but trying that resulted in a crash while decompiling unionall.ssb.
  # We thus do not rebuild them.

  postPatch = ''
    substituteInPlace Makefile \
      --replace-fail ./generate_parser_bindings.py "python3 ./generate_parser_bindings.py"

    # Doesn’t detect that package for some reason
    substituteInPlace pyproject.toml \
      --replace-fail "\"scikit-build-core<=0.9.8\"," ""
  '';

  dontUseCmakeConfigure = true;

  propagatedBuildInputs = [
    igraph
    pybind11
  ];

  optional-dependencies.pygments = [ pygments ];

  nativeCheckInputs = [ pytestCheckHook ] ++ optional-dependencies.pygments;

  pythonImportsCheck = [ "explorerscript" ];

  meta = with lib; {
    homepage = "https://github.com/SkyTemple/explorerscript";
    description = "Programming language + compiler/decompiler for creating scripts for Pokémon Mystery Dungeon Explorers of Sky";
    license = licenses.mit;
    maintainers = with maintainers; [ marius851000 ];
  };
}