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