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

r26:d90c2f5a3181 -

@@ -11,11 +11,46
11 template_directory = pathlib.Path("PackageTemplates/")
11 template_directory = pathlib.Path("PackageTemplates/")
12 macos_template = template_directory / "isometric-park-template.app"
12 macos_template = template_directory / "isometric-park-template.app"
13 windows_template = template_directory / "isometric-park-windows-template"
13 windows_template = template_directory / "isometric-park-windows-template"
14 linux_template = template_directory / "isometric-park-linux-template"
14
15
15 sourcedir = "isometric-park-fna/bin/Release"
16 sourcedir = "isometric-park-fna/bin/Release"
16 destination_directory = pathlib.Path("isometric-park-fna/bin/")
17 destination_directory = pathlib.Path("isometric-park-fna/bin/")
17
18
18
19
20 def make_linux(suffix="new"):
21 new_name = destination_directory / (linux_template.name[:-9] + "-" + suffix)
22 # shutil.rmtree(new_name)
23 shutil.copytree(linux_template, new_name)
24
25 for (dirpath, _dirname, files) in os.walk(sourcedir):
26 for file in files:
27 source = pathlib.Path(dirpath) / file
28 destination = pathlib.Path(new_name) / os.path.relpath(sourcedir, dirpath) / pathlib.Path(file)
29
30 print(source, destination)
31
32 if source.parent.is_dir() and not destination.parent.exists():
33 # shutil.copytree(source.parent, destination.parent)
34 os.mkdir(destination.parent)
35 elif source.is_dir() and not destination.exists():
36 shutil.copytree(source, destination)
37 else:
38 shutil.copy2(source, destination)
39
40 shutil.move(pathlib.Path(new_name) / "isometric-park-fna.exe",
41 pathlib.Path(new_name) / "isometric-park.exe")
42
43 new_zip_name = new_name.parent / (new_name.name + ".zip")
44
45 with zipfile.ZipFile(new_zip_name, "w",
46 #May be able to use something better on Linux:
47 compression=zipfile.ZIP_DEFLATED) as f:
48 for (dirpath, _dirname, files) in os.walk(sourcedir):
49 for file in files:
50 source = pathlib.Path(dirpath) / file
51 f.write(source)
52
53
19 def make_windows(suffix="new"):
54 def make_windows(suffix="new"):
20 new_name = destination_directory / (windows_template.name[:-9] + "-" + suffix)
55 new_name = destination_directory / (windows_template.name[:-9] + "-" + suffix)
21 # shutil.rmtree(new_name)
56 # shutil.rmtree(new_name)
@@ -28,7 +63,10
28
63
29 print(source, destination)
64 print(source, destination)
30
65
31 if source.is_dir() and not destination.exists():
66 if source.parent.is_dir() and not destination.parent.exists():
67 # shutil.copytree(source.parent, destination.parent)
68 os.mkdir(destination.parent)
69 elif source.is_dir() and not destination.exists():
32 shutil.copytree(source, destination)
70 shutil.copytree(source, destination)
33 else:
71 else:
34 shutil.copy2(source, destination)
72 shutil.copy2(source, destination)
@@ -58,11 +96,14
58 for (dirpath, _dirname, files) in os.walk(sourcedir):
96 for (dirpath, _dirname, files) in os.walk(sourcedir):
59 for file in files:
97 for file in files:
60 source = pathlib.Path(dirpath) / file
98 source = pathlib.Path(dirpath) / file
61 destination = new_name / "Contents" / "Resources" / pathlib.Path(file)
99 destination = new_name / "Contents" / "Resources" / os.path.relpath(dirpath, sourcedir) / file
62
100
63 print(source, destination)
101 print(source, destination)
64
102
65 if source.is_dir() and not destination.exists():
103 if source.parent.is_dir() and not destination.parent.exists():
104 # shutil.copytree(source.parent, destination.parent)
105 os.mkdir(destination.parent)
106 elif source.is_dir() and not destination.exists():
66 shutil.copytree(source, destination)
107 shutil.copytree(source, destination)
67 else:
108 else:
68 shutil.copy2(source, destination)
109 shutil.copy2(source, destination)
You need to be logged in to leave comments. Login now