Show More
Commit Description:
Add packaging script.
Commit Description:
Add packaging script.
File last commit:
Show/Diff file:
Action:
scripts/package.py
56 lines | 1.4 KiB | text/x-python | PythonLexer
#!/bin/env python3
import zipfile
import sys
import shutil
import os
import pathlib
macos_template = "isometric-park-fna/bin/isometric-park-template.app"
windows_template = "isometric-park-fna/bin/isometric-park-windows-template"
def make_windows(suffix="new"):
pass
def make_macos(suffix="new"):
new_name = macos_template[:-4] + "-" + suffix + ".app" + "/"
dirpath = "isometric-park-fna/bin/Release"
shutil.rmtree(new_name)
shutil.copytree(macos_template, new_name)
for (dirpath, _dirname, files) in os.walk(dirpath):
for file in files:
source = pathlib.Path(dirpath) / file
destination = pathlib.Path(new_name) / "Contents" / "Resources" / pathlib.Path(file)
print(source, destination)
if source.is_dir() and not destination.exists():
shutil.copytree(source, destination)
else:
shutil.copy2(source, destination)
shutil.move(pathlib.Path(new_name) / "Contents" / "Resources" / "isometric-park-fna.exe",
pathlib.Path(new_name) / "Contents" / "Resources" / "isometric-park.exe")
def main():
print(_, command, arg)
if len(sys.argv) > 1:
command = sys.argv[1]
if command == "macos":
if len(sys.argv) > 2:
make_macos(sys.argv[2])
else:
pass
if __name__ == '__main__':
main()