Description:
Update packaging script.
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r25:6207cd7a2f3c -

@@ -8,14 +8,16
8 8 import os
9 9 import pathlib
10 10
11 macos_template = "isometric-park-fna/bin/isometric-park-template.app"
12 windows_template = "isometric-park-fna/bin/isometric-park-windows-template"
11 template_directory = pathlib.Path("PackageTemplates/")
12 macos_template = template_directory / "isometric-park-template.app"
13 windows_template = template_directory / "isometric-park-windows-template"
13 14
14 15 sourcedir = "isometric-park-fna/bin/Release"
16 destination_directory = pathlib.Path("isometric-park-fna/bin/")
15 17
16 18
17 19 def make_windows(suffix="new"):
18 new_name = windows_template[:-9] + "-" + suffix
20 new_name = destination_directory / (windows_template.name[:-9] + "-" + suffix)
19 21 # shutil.rmtree(new_name)
20 22 shutil.copytree(windows_template, new_name)
21 23
@@ -34,7 +36,9
34 36 shutil.move(pathlib.Path(new_name) / "isometric-park-fna.exe",
35 37 pathlib.Path(new_name) / "isometric-park.exe")
36 38
37 with zipfile.ZipFile(new_name + ".zip", "w",
39 new_zip_name = new_name.parent / (new_name.name + ".zip")
40
41 with zipfile.ZipFile(new_zip_name, "w",
38 42 #Windows doesn't natively support other formats
39 43 #(besides uncompressed) in my testing:
40 44 compression=zipfile.ZIP_DEFLATED) as f:
@@ -46,7 +50,7
46 50
47 51 def make_macos(suffix="new"):
48 52
49 new_name = macos_template[:-4] + "-" + suffix + ".app" + "/"
53 new_name = destination_directory / (macos_template.name[:-4] + "-" + suffix + ".app" + "/")
50 54
51 55 # shutil.rmtree(new_name)
52 56 shutil.copytree(macos_template, new_name)
@@ -54,7 +58,7
54 58 for (dirpath, _dirname, files) in os.walk(sourcedir):
55 59 for file in files:
56 60 source = pathlib.Path(dirpath) / file
57 destination = pathlib.Path(new_name) / "Contents" / "Resources" / pathlib.Path(file)
61 destination = new_name / "Contents" / "Resources" / pathlib.Path(file)
58 62
59 63 print(source, destination)
60 64
@@ -69,12 +73,13
69 73
70 74 def make_source(suffix="new"):
71 75
72 new_name = "isometric-park-fna/bin/isometric-park-source" + "-" + suffix
76 new_name = destination_directory / ("isometric-park-source" + "-" + suffix
77 + ".zip")
73 78
74 79 with tempfile.TemporaryDirectory() as temp:
75 80 print(subprocess.getoutput(f"hg clone . {temp}"))
76 81
77 with zipfile.ZipFile(new_name + ".zip", "w",
82 with zipfile.ZipFile(new_name, "w",
78 83 #Windows doesn't natively support other formats
79 84 #(besides uncompressed) in my testing:
80 85 compression=zipfile.ZIP_DEFLATED) as f:
@@ -82,7 +87,7
82 87 for file in files:
83 88 source = pathlib.Path(dirpath) / file
84 89 print(os.path.relpath(source, temp))
85 f.write(source, os.path.relpath(source, temp) )
90 f.write(source, os.path.relpath(source, temp))
86 91
87 92
88 93 def main():
You need to be logged in to leave comments. Login now