22import re
33import shutil
44import subprocess
5- import textwrap
65import tomllib
76from collections .abc import Iterator , Sequence
87from functools import cache
2423
2524LICENSE = THIS_FOLDER / "LICENSE"
2625
26+ MODS_WITH_EXISTING_LICENSE = {
27+ # These have their own due to being submodules
28+ BASE_MOD ,
29+ CONSOLE_MENU ,
30+ }
31+
2732BUILD_DIR_BASE = THIS_FOLDER / "out" / "build"
2833INSTALL_DIR_BASE = THIS_FOLDER / "out" / "install"
2934
3338PYPROJECT_FILE = THIS_FOLDER / "manager_pyproject.toml"
3439
3540
41+ # Primarily to skip over all the dotfiles in mods which are submodules
42+ VALID_MOD_FILE_SUFFIXES = {".py" , ".pyi" , ".pyd" , ".md" }
43+
44+
45+ # Regex to extract presets from a `cmake --list-presets` command
3646LIST_PRESETS_RE = re .compile (' "(.+)"' )
3747
3848
@@ -106,7 +116,7 @@ def iter_mod_files(mod_folder: Path, debug: bool) -> Iterator[Path]:
106116 if file .parent .name == "__pycache__" :
107117 continue
108118
109- if file .suffix == ".cpp" :
119+ if file .suffix not in VALID_MOD_FILE_SUFFIXES :
110120 continue
111121 if file .suffix == ".pyd" and file .stem .endswith ("_d" ) != debug :
112122 continue
@@ -151,7 +161,8 @@ def _zip_mod_folders(zip_file: ZipFile, mod_folders: Sequence[Path], debug: bool
151161 )
152162
153163 # Add the license
154- zip_file .write (LICENSE , ZIP_MODS_FOLDER / mod .name / LICENSE .name )
164+ license_file = mod / "LICENSE" if mod in MODS_WITH_EXISTING_LICENSE else LICENSE
165+ zip_file .write (license_file , ZIP_MODS_FOLDER / mod .name / LICENSE .name )
155166 else :
156167 # Otherwise, we can add it as a .sdkmod
157168 buffer = BytesIO ()
@@ -163,7 +174,8 @@ def _zip_mod_folders(zip_file: ZipFile, mod_folders: Sequence[Path], debug: bool
163174 )
164175
165176 # Add the license
166- sdkmod_zip .write (LICENSE , Path (mod .name ) / LICENSE .name )
177+ license_file = mod / "LICENSE" if mod in MODS_WITH_EXISTING_LICENSE else LICENSE
178+ sdkmod_zip .write (license_file , Path (mod .name ) / LICENSE .name )
167179
168180 buffer .seek (0 )
169181 zip_file .writestr (
@@ -212,18 +224,6 @@ def _zip_dlls(zip_file: ZipFile, install_dir: Path) -> None:
212224
213225 zip_file .write (file , dest )
214226
215- py_stem = next (install_dir .glob ("python*.zip" )).stem
216- zip_file .writestr (
217- str (ZIP_PLUGINS_FOLDER / (py_stem + "._pth" )),
218- textwrap .dedent (
219- f"""
220- { path .relpath (ZIP_MODS_FOLDER , ZIP_PLUGINS_FOLDER )}
221- { py_stem } .zip
222- DLLs
223- """ ,
224- )[1 :- 1 ],
225- )
226-
227227
228228def zip_release (
229229 output : Path ,
0 commit comments