|
20 | 20 | } |
21 | 21 |
|
22 | 22 | package_gem = value_mappings[sys.argv[1].upper()] |
23 | | -use_xz = value_mappings[sys.argv[2].upper()] |
24 | 23 | output_dir = sys.argv[3] |
25 | 24 |
|
26 | 25 | # Utility filesystem functions |
@@ -76,16 +75,12 @@ def existsAsDir(path): |
76 | 75 | return os.path.isdir(path) |
77 | 76 |
|
78 | 77 | def makeArchive(name, root_dir, base_dir): |
79 | | - if use_xz: |
80 | | - archive_path = os.path.abspath(name) |
81 | | - preset = 9 | lzma.PRESET_EXTREME # max compression |
82 | | - with lzma.open(archive_path, "wb", preset=preset) as xz_out: |
83 | | - with tarfile.open(fileobj=xz_out, mode="w|") as tar: |
84 | | - full_path = os.path.join(root_dir, base_dir) |
85 | | - tar.add(full_path, arcname=base_dir) |
86 | | - else: |
87 | | - shutil.make_archive(name, "zip", root_dir, base_dir) |
88 | | - moveFile("./Filesystem.zip", "./Filesystem") |
| 78 | + archive_path = os.path.abspath(name) |
| 79 | + preset = 9 | lzma.PRESET_EXTREME # max compression |
| 80 | + with lzma.open(archive_path, "wb", preset=preset) as xz_out: |
| 81 | + with tarfile.open(fileobj=xz_out, mode="w|") as tar: |
| 82 | + full_path = os.path.join(root_dir, base_dir) |
| 83 | + tar.add(full_path, arcname=base_dir) |
89 | 84 |
|
90 | 85 | def split(a, n): |
91 | 86 | k, m = divmod(len(a), n) |
@@ -328,7 +323,7 @@ def generate_binary_data(output_dir, file_list): |
328 | 323 |
|
329 | 324 | makeArchive("Filesystem", "./", "./plugdata_version") |
330 | 325 | with open(project_root + "/Resources/Fonts/InterUnicode.ttf", 'rb') as f_in: |
331 | | - with lzma.open(output_dir + "/InterUnicode.ttf.xz", 'wb') as f_out: |
| 326 | + with lzma.open(output_dir + "/InterUnicode.ttf.xz", 'wb', preset=5) as f_out: |
332 | 327 | shutil.copyfileobj(f_in, f_out) |
333 | 328 | removeDir(output_dir + "/plugdata_version") |
334 | 329 |
|
|
0 commit comments