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 import os
8 import os
9 import pathlib
9 import pathlib
10
10
11 macos_template = "isometric-park-fna/bin/isometric-park-template.app"
11 template_directory = pathlib.Path("PackageTemplates/")
12 windows_template = "isometric-park-fna/bin/isometric-park-windows-template"
12 macos_template = template_directory / "isometric-park-template.app"
13 windows_template = template_directory / "isometric-park-windows-template"
13
14
14 sourcedir = "isometric-park-fna/bin/Release"
15 sourcedir = "isometric-park-fna/bin/Release"
16 destination_directory = pathlib.Path("isometric-park-fna/bin/")
15
17
16
18
17 def make_windows(suffix="new"):
19 def make_windows(suffix="new"):
18 new_name = windows_template[:-9] + "-" + suffix
20 new_name = destination_directory / (windows_template.name[:-9] + "-" + suffix)
19 # shutil.rmtree(new_name)
21 # shutil.rmtree(new_name)
20 shutil.copytree(windows_template, new_name)
22 shutil.copytree(windows_template, new_name)
21
23
@@ -34,7 +36,9
34 shutil.move(pathlib.Path(new_name) / "isometric-park-fna.exe",
36 shutil.move(pathlib.Path(new_name) / "isometric-park-fna.exe",
35 pathlib.Path(new_name) / "isometric-park.exe")
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 #Windows doesn't natively support other formats
42 #Windows doesn't natively support other formats
39 #(besides uncompressed) in my testing:
43 #(besides uncompressed) in my testing:
40 compression=zipfile.ZIP_DEFLATED) as f:
44 compression=zipfile.ZIP_DEFLATED) as f:
@@ -46,7 +50,7
46
50
47 def make_macos(suffix="new"):
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 # shutil.rmtree(new_name)
55 # shutil.rmtree(new_name)
52 shutil.copytree(macos_template, new_name)
56 shutil.copytree(macos_template, new_name)
@@ -54,7 +58,7
54 for (dirpath, _dirname, files) in os.walk(sourcedir):
58 for (dirpath, _dirname, files) in os.walk(sourcedir):
55 for file in files:
59 for file in files:
56 source = pathlib.Path(dirpath) / file
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 print(source, destination)
63 print(source, destination)
60
64
@@ -69,12 +73,13
69
73
70 def make_source(suffix="new"):
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 with tempfile.TemporaryDirectory() as temp:
79 with tempfile.TemporaryDirectory() as temp:
75 print(subprocess.getoutput(f"hg clone . {temp}"))
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 #Windows doesn't natively support other formats
83 #Windows doesn't natively support other formats
79 #(besides uncompressed) in my testing:
84 #(besides uncompressed) in my testing:
80 compression=zipfile.ZIP_DEFLATED) as f:
85 compression=zipfile.ZIP_DEFLATED) as f:
@@ -82,7 +87,7
82 for file in files:
87 for file in files:
83 source = pathlib.Path(dirpath) / file
88 source = pathlib.Path(dirpath) / file
84 print(os.path.relpath(source, temp))
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 def main():
93 def main():
You need to be logged in to leave comments. Login now