- proc = subprocess.run(cmd, cwd=str(nominatim_env.project_dir), env=env,
- check=throw_on_fail)
+def run_osm2pgsql(options: Mapping[str, Any]) -> None:
+ """ Run osm2pgsql with the given options.
+ """
+ env = get_pg_env(options['dsn'])
+ cmd = [str(options['osm2pgsql']),
+ '--slim',
+ '--log-progress', 'true',
+ '--number-processes', '1' if options['append'] else str(options['threads']),
+ '--cache', str(options['osm2pgsql_cache']),
+ '--style', str(options['osm2pgsql_style'])
+ ]
+
+ if str(options['osm2pgsql_style']).endswith('.lua'):
+ env['LUA_PATH'] = ';'.join((str(options['osm2pgsql_style_path'] / '?.lua'),
+ os.environ.get('LUAPATH', ';')))
+ cmd.extend(('--output', 'flex'))
+ else:
+ cmd.extend(('--output', 'gazetteer', '--hstore', '--latlon'))