Add temp dir to variable used by osmosis startup script to prevent crash on run
This commit is contained in:
parent
b6b11a9318
commit
258bc7c8c6
|
@ -15,6 +15,7 @@
|
|||
import subprocess, sys, os, pprint, datetime, argparse, time
|
||||
|
||||
base_path = os.path.dirname(os.path.realpath(__file__))
|
||||
env = os.environ.copy()
|
||||
|
||||
FNULL = open(os.devnull, 'w')
|
||||
|
||||
|
@ -65,13 +66,14 @@ if __name__ == '__main__':
|
|||
subprocess.run([bunzip2_cmd, os.path.join(dirpath, file)])
|
||||
|
||||
print('Processing maps using osmosis')
|
||||
env['JAVACMD_OPTIONS'] = '-Djava.io.tmpdir=' + os.path.join(base_path, 'tmp') # Setup java temp dir to something a bit more sane (tmpfs /tmp for the loss)
|
||||
files_to_process = []
|
||||
for dirpath, dirnames, filenames in os.walk('dl'):
|
||||
for file in filenames:
|
||||
print(' Found map: ', end='')
|
||||
print(os.path.join(dirpath, file))
|
||||
files_to_process.append(os.path.join(dirpath, file))
|
||||
osmosis_cmd = [os.path.join(base_path, 'bin', 'osmosis', 'bin', 'osmosis'), '-Djava.io.tmpdir=' + os.path.join(base_path, 'tmp')]
|
||||
osmosis_cmd = [os.path.join(base_path, 'bin', 'osmosis', 'bin', 'osmosis')]
|
||||
for file in files_to_process:
|
||||
if file.endswith('osm'):
|
||||
osmosis_cmd.extend(['--rx', 'file=' + file])
|
||||
|
@ -80,5 +82,6 @@ if __name__ == '__main__':
|
|||
for x in range(0, len(files_to_process) - 1):
|
||||
osmosis_cmd.append('--merge')
|
||||
osmosis_cmd.extend(['--mapfile-writer', 'file=output.map', 'type=hd'])
|
||||
subprocess.run(osmosis_cmd)
|
||||
cmd = subprocess.Popen(osmosis_cmd, env=env)
|
||||
cmd.wait()
|
||||
|
||||
|
|
Reference in a new issue