1{
2 stdenv,
3 lib,
4 buildPythonPackage,
5 fetchFromGitHub,
6 appdirs,
7 dungeon-eos,
8 explorerscript,
9 ndspy,
10 pillow,
11 setuptools,
12 skytemple-rust,
13 tilequant,
14 pyyaml,
15 pmdsky-debug-py,
16 range-typed-integers,
17 importlib-resources,
18 typing-extensions,
19 pythonOlder,
20 # optional dependancies for SpriteCollab
21 aiohttp,
22 lru-dict,
23 graphql-core,
24 gql,
25 armips,
26 # tests
27 pytestCheckHook,
28 parameterized,
29 xmldiff,
30}:
31
32buildPythonPackage rec {
33 pname = "skytemple-files";
34 version = "1.6.5";
35 pyproject = true;
36
37 src = fetchFromGitHub {
38 owner = "SkyTemple";
39 repo = pname;
40 rev = version;
41 hash = "sha256-y6VHRfwQNoehp06BoZXuprYtsiGgoNL4rztJw40P4FI=";
42 # Most patches are in submodules
43 fetchSubmodules = true;
44 };
45
46 postPatch = ''
47 substituteInPlace skytemple_files/patch/arm_patcher.py skytemple_files/data/data_cd/armips_importer.py \
48 --replace "exec_name = os.getenv(\"SKYTEMPLE_ARMIPS_EXEC\", f\"{prefix}armips\")" "exec_name = \"${armips}/bin/armips\""
49 '';
50
51 buildInputs = [ armips ];
52
53 propagatedBuildInputs =
54 [
55 appdirs
56 dungeon-eos
57 explorerscript
58 ndspy
59 pillow
60 setuptools
61 skytemple-rust
62 tilequant
63 pyyaml
64 pmdsky-debug-py
65 range-typed-integers
66 ]
67 ++ lib.optionals (pythonOlder "3.9") [
68 importlib-resources
69 typing-extensions
70 ];
71
72 passthru.optional-dependencies = {
73 spritecollab = [
74 aiohttp
75 gql
76 graphql-core
77 lru-dict
78 ] ++ gql.optional-dependencies.aiohttp;
79 };
80
81 checkInputs = [
82 pytestCheckHook
83 parameterized
84 xmldiff
85 ] ++ passthru.optional-dependencies.spritecollab;
86 pytestFlagsArray = [ "test/" ];
87 disabledTestPaths = [
88 "test/skytemple_files_test/common/spritecollab/sc_online_test.py"
89 "test/skytemple_files_test/compression_container/atupx/atupx_test.py" # Particularly long test
90 ];
91
92 pythonImportsCheck = [ "skytemple_files" ];
93
94 meta = with lib; {
95 homepage = "https://github.com/SkyTemple/skytemple-files";
96 description = "Python library to edit the ROM of Pokémon Mystery Dungeon Explorers of Sky";
97 mainProgram = "skytemple_export_maps";
98 license = licenses.gpl3Plus;
99 maintainers = with maintainers; [ marius851000 ];
100 broken = stdenv.isDarwin; # pyobjc is missing
101 };
102}