mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-26 11:08:13 +00:00
fix merge issues
This commit is contained in:
@@ -30,13 +30,7 @@ def run_osm2pgsql(options: Mapping[str, Any]) -> None:
|
|||||||
"""
|
"""
|
||||||
env = get_pg_env(options['dsn'])
|
env = get_pg_env(options['dsn'])
|
||||||
|
|
||||||
osm2pgsql_cmd = options['osm2pgsql']
|
cmd = [_find_osm2pgsql_cmd(options['osm2pgsql']),
|
||||||
if osm2pgsql_cmd is None:
|
|
||||||
osm2pgsql_cmd = shutil.which('osm2pgsql')
|
|
||||||
if osm2pgsql_cmd is None:
|
|
||||||
raise RuntimeError('osm2pgsql executable not found. Please install osm2pgsql first.')
|
|
||||||
|
|
||||||
cmd = [str(osm2pgsql_cmd),
|
|
||||||
'--slim',
|
'--slim',
|
||||||
'--log-progress', 'true',
|
'--log-progress', 'true',
|
||||||
'--number-processes', '1' if options['append'] else str(options['threads']),
|
'--number-processes', '1' if options['append'] else str(options['threads']),
|
||||||
@@ -82,3 +76,14 @@ def run_osm2pgsql(options: Mapping[str, Any]) -> None:
|
|||||||
subprocess.run(cmd, cwd=options.get('cwd', '.'),
|
subprocess.run(cmd, cwd=options.get('cwd', '.'),
|
||||||
input=options.get('import_data'),
|
input=options.get('import_data'),
|
||||||
env=env, check=True)
|
env=env, check=True)
|
||||||
|
|
||||||
|
|
||||||
|
def _find_osm2pgsql_cmd(cmdline: str) -> str:
|
||||||
|
if cmdline is not None:
|
||||||
|
return cmdline
|
||||||
|
|
||||||
|
in_path = shutil.which('osm2pgsql')
|
||||||
|
if in_path is None:
|
||||||
|
raise RuntimeError('osm2pgsql executable not found. Please install osm2pgsql first.')
|
||||||
|
|
||||||
|
return str(in_path)
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ class TestRefresh:
|
|||||||
lambda *args, **kwargs: calls.append('import') or 0)
|
lambda *args, **kwargs: calls.append('import') or 0)
|
||||||
monkeypatch.setattr(nominatim_db.tools.refresh, 'recompute_importance',
|
monkeypatch.setattr(nominatim_db.tools.refresh, 'recompute_importance',
|
||||||
lambda *args, **kwargs: calls.append('update'))
|
lambda *args, **kwargs: calls.append('update'))
|
||||||
func_mock = mock_func_factory(nominatim.tools.refresh, 'create_functions')
|
func_mock = mock_func_factory(nominatim_db.tools.refresh, 'create_functions')
|
||||||
|
|
||||||
assert self.call_nominatim('refresh', '--importance', '--wiki-data') == 0
|
assert self.call_nominatim('refresh', '--importance', '--wiki-data') == 0
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import csv
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from nominatim.tools.refresh import import_wikipedia_articles, recompute_importance, create_functions
|
from nominatim_db.tools.refresh import import_wikipedia_articles, recompute_importance, create_functions
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def wiki_csv(tmp_path, sql_preprocessor):
|
def wiki_csv(tmp_path, sql_preprocessor):
|
||||||
|
|||||||
Reference in New Issue
Block a user