Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DEV] Unify zipping & integrate last bits of PR-40 #55

Merged
merged 3 commits into from
Oct 26, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 9 additions & 14 deletions common_python/osm_maps_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,6 @@ def merge_splitted_tiles_with_land_and_sea(self, calc_border_countries):
cmd.append('workers=' + self.workers)
cmd.append('--merge')

cmd.append('workers=' + self.workers)
loop += 1
land_files = glob.glob(os.path.join(fd_fct.OUTPUT_DIR,
f'{tile["x"]}', f'{tile["y"]}', 'land*.osm'))
Expand Down Expand Up @@ -486,9 +485,8 @@ def create_map_files(self, save_cruiser, tag_wahoo_xml):
out_file+'.lzma', f'-mt{threads}', '-d27', '-fb273', '-eos']
# Non-Windows
else:
cmd = ['lzma', out_file]
# force overwrite of output file and (de)compress links
cmd.extend(['-f'])
cmd = ['lzma', out_file, '-f']

# --keep: do not delete source file
if save_cruiser:
Expand Down Expand Up @@ -552,16 +550,14 @@ def zip_map_files(self, keep_map_folders):
# Windows
if platform.system() == "Windows":
path_7za = os.path.join(fd_fct.TOOLING_WIN_DIR, '7za')
cmd = [path_7za, 'a', '-tzip', self.country_name,
os.path.join(f'{fd_fct.OUTPUT_DIR}', f'{self.country_name}', '*')]
cmd = [path_7za, 'a', '-tzip', self.country_name + '.zip']

# Non-Windows
else:
cmd = ['zip', '-r', self.country_name + '.zip',
os.path.join(f'{fd_fct.OUTPUT_DIR}', f'{self.country_name}', '*')]
cmd = ['zip', '-r', self.country_name + '.zip']

for tile in self.tiles:
cmd.append(os.path.join(f'{tile["x"]}', f'{tile["y"]}.map.lzma'))
cmd.append(os.path.join(
f'{fd_fct.OUTPUT_DIR}', f'{self.country_name}', '*'))

subprocess.run(cmd, cwd=fd_fct.OUTPUT_DIR, check=True)

Expand Down Expand Up @@ -611,15 +607,14 @@ def make_cruiser_files(self, keep_map_folders):
# Windows
if platform.system() == "Windows":
cmd = [os.path.join(fd_fct.TOOLING_WIN_DIR, '7za'), 'a', '-tzip', self.country_name +
'-maps.zip', os.path.join(f'{fd_fct.OUTPUT_DIR}', f'{self.country_name}-maps', '*')]
'-maps.zip']

# Non-Windows
else:
cmd = ['zip', '-r', self.country_name + '-maps.zip',
os.path.join(f'{fd_fct.OUTPUT_DIR}', f'{self.country_name}-maps', '*')]
cmd = ['zip', '-r', self.country_name + '-maps.zip']

for tile in self.tiles:
cmd.append(os.path.join(f'{tile["x"]}', f'{tile["y"]}.map'))
cmd.append(os.path.join(f'{fd_fct.OUTPUT_DIR}',
f'{self.country_name}-maps', '*'))

subprocess.run(cmd, cwd=fd_fct.OUTPUT_DIR, check=True)

Expand Down