Description:
Add packaging script.
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
@@ -0,0 +1,56 | |||||
|
|
1 | #!/bin/env python3 | ||
|
|
2 | |||
|
|
3 | import zipfile | ||
|
|
4 | import sys | ||
|
|
5 | import shutil | ||
|
|
6 | import os | ||
|
|
7 | import pathlib | ||
|
|
8 | |||
|
|
9 | macos_template = "isometric-park-fna/bin/isometric-park-template.app" | ||
|
|
10 | windows_template = "isometric-park-fna/bin/isometric-park-windows-template" | ||
|
|
11 | |||
|
|
12 | |||
|
|
13 | def make_windows(suffix="new"): | ||
|
|
14 | pass | ||
|
|
15 | |||
|
|
16 | |||
|
|
17 | def make_macos(suffix="new"): | ||
|
|
18 | |||
|
|
19 | new_name = macos_template[:-4] + "-" + suffix + ".app" + "/" | ||
|
|
20 | dirpath = "isometric-park-fna/bin/Release" | ||
|
|
21 | |||
|
|
22 | shutil.rmtree(new_name) | ||
|
|
23 | shutil.copytree(macos_template, new_name) | ||
|
|
24 | |||
|
|
25 | for (dirpath, _dirname, files) in os.walk(dirpath): | ||
|
|
26 | for file in files: | ||
|
|
27 | source = pathlib.Path(dirpath) / file | ||
|
|
28 | destination = pathlib.Path(new_name) / "Contents" / "Resources" / pathlib.Path(file) | ||
|
|
29 | |||
|
|
30 | print(source, destination) | ||
|
|
31 | |||
|
|
32 | if source.is_dir() and not destination.exists(): | ||
|
|
33 | shutil.copytree(source, destination) | ||
|
|
34 | else: | ||
|
|
35 | shutil.copy2(source, destination) | ||
|
|
36 | |||
|
|
37 | |||
|
|
38 | shutil.move(pathlib.Path(new_name) / "Contents" / "Resources" / "isometric-park-fna.exe", | ||
|
|
39 | pathlib.Path(new_name) / "Contents" / "Resources" / "isometric-park.exe") | ||
|
|
40 | |||
|
|
41 | |||
|
|
42 | def main(): | ||
|
|
43 | print(_, command, arg) | ||
|
|
44 | if len(sys.argv) > 1: | ||
|
|
45 | command = sys.argv[1] | ||
|
|
46 | |||
|
|
47 | if command == "macos": | ||
|
|
48 | if len(sys.argv) > 2: | ||
|
|
49 | make_macos(sys.argv[2]) | ||
|
|
50 | else: | ||
|
|
51 | pass | ||
|
|
52 | |||
|
|
53 | |||
|
|
54 | |||
|
|
55 | if __name__ == '__main__': | ||
|
|
56 | main() |
You need to be logged in to leave comments.
Login now