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