Description:
Add Windows support to build script.
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
|
1 | NO CONTENT: modified file, binary diff hidden |
@@ -9,20 +9,46 | |||
|
9 | 9 | macos_template = "isometric-park-fna/bin/isometric-park-template.app" |
|
10 | 10 | windows_template = "isometric-park-fna/bin/isometric-park-windows-template" |
|
11 | 11 | |
|
12 | sourcedir = "isometric-park-fna/bin/Release" | |
|
12 | 13 | |
|
13 | 14 | def make_windows(suffix="new"): |
|
14 | pass | |
|
15 | new_name = windows_template[:-9] + "-" + suffix | |
|
16 | ||
|
17 | # shutil.rmtree(new_name) | |
|
18 | shutil.copytree(windows_template, new_name) | |
|
19 | ||
|
20 | for (dirpath, _dirname, files) in os.walk(sourcedir): | |
|
21 | for file in files: | |
|
22 | source = pathlib.Path(dirpath) / file | |
|
23 | destination = pathlib.Path(new_name) / os.path.relpath(sourcedir, dirpath) / pathlib.Path(file) | |
|
24 | ||
|
25 | print(source, destination) | |
|
15 | 26 | |
|
27 | if source.is_dir() and not destination.exists(): | |
|
28 | shutil.copytree(source, destination) | |
|
29 | else: | |
|
30 | shutil.copy2(source, destination) | |
|
31 | ||
|
32 | shutil.move(pathlib.Path(new_name) / "isometric-park-fna.exe", | |
|
33 | pathlib.Path(new_name) / "isometric-park.exe") | |
|
34 | ||
|
35 | with zipfile.ZipFile(new_name + ".zip", "w", | |
|
36 | #Windows doesn't natively support other formats | |
|
37 | #(besides uncompressed) in my testing: | |
|
38 | compression=zipfile.ZIP_DEFLATED) as f: | |
|
39 | for (dirpath, _dirname, files) in os.walk(sourcedir): | |
|
40 | for file in files: | |
|
41 | source = pathlib.Path(dirpath) / file | |
|
42 | f.write(source) | |
|
16 | 43 | |
|
17 | 44 | def make_macos(suffix="new"): |
|
18 | 45 | |
|
19 | 46 | new_name = macos_template[:-4] + "-" + suffix + ".app" + "/" |
|
20 | dirpath = "isometric-park-fna/bin/Release" | |
|
21 | 47 | |
|
22 | shutil.rmtree(new_name) | |
|
48 | # shutil.rmtree(new_name) | |
|
23 | 49 | shutil.copytree(macos_template, new_name) |
|
24 | 50 | |
|
25 |
for (dirpath, _dirname, files) in os.walk(dir |
|
|
51 | for (dirpath, _dirname, files) in os.walk(sourcedir): | |
|
26 | 52 | for file in files: |
|
27 | 53 | source = pathlib.Path(dirpath) / file |
|
28 | 54 | destination = pathlib.Path(new_name) / "Contents" / "Resources" / pathlib.Path(file) |
@@ -34,19 +60,24 | |||
|
34 | 60 | else: |
|
35 | 61 | shutil.copy2(source, destination) |
|
36 | 62 | |
|
37 | ||
|
38 | 63 | shutil.move(pathlib.Path(new_name) / "Contents" / "Resources" / "isometric-park-fna.exe", |
|
39 | 64 | pathlib.Path(new_name) / "Contents" / "Resources" / "isometric-park.exe") |
|
40 | 65 | |
|
41 | 66 | |
|
42 | 67 | def main(): |
|
43 | print(_, command, arg) | |
|
44 | 68 | if len(sys.argv) > 1: |
|
45 | 69 | command = sys.argv[1] |
|
46 | 70 | |
|
47 | if command == "macos": | |
|
71 | if command.lower() == "macos": | |
|
48 | 72 | if len(sys.argv) > 2: |
|
49 | 73 | make_macos(sys.argv[2]) |
|
74 | else: | |
|
75 | make_macos() | |
|
76 | elif command.lower() in ("win", "windows"): | |
|
77 | if len(sys.argv) > 2: | |
|
78 | make_windows(sys.argv[2]) | |
|
79 | else: | |
|
80 | make_windows() | |
|
50 | 81 | else: |
|
51 | 82 | pass |
|
52 | 83 |
You need to be logged in to leave comments.
Login now