remove code for setting osm2pgsql via config.lib_dir

With the internal osm2pgsql gone, configuration of the binary location
via settings is the only option left that makes sense.
This commit is contained in:
Sarah Hoffmann
2025-03-11 08:45:10 +01:00
parent cd08956c61
commit f5755a7a82
12 changed files with 33 additions and 36 deletions

View File

@@ -16,8 +16,7 @@ import nominatim_db.cli
def run_export(tmp_path, capsys):
def _exec(args):
cli_args = ['export', '--project-dir', str(tmp_path)] + args
assert 0 == nominatim_db.cli.nominatim(osm2pgsql_path='OSM2PGSQL NOT AVAILABLE',
cli_args=cli_args)
assert 0 == nominatim_db.cli.nominatim(cli_args=cli_args)
return capsys.readouterr().out.split('\r\n')
return _exec

View File

@@ -29,6 +29,5 @@ def setup_database_with_context(apiobj, table_factory):
@pytest.mark.parametrize('args', [['--search-only'], ['--reverse-only']])
def test_warm_all(tmp_path, args):
assert 0 == nominatim_db.cli.nominatim(osm2pgsql_path='OSM2PGSQL NOT AVAILABLE',
cli_args=['admin', '--project-dir', str(tmp_path),
assert 0 == nominatim_db.cli.nominatim(cli_args=['admin', '--project-dir', str(tmp_path),
'--warm'] + args)

View File

@@ -69,8 +69,7 @@ def cli_call():
Returns a function that can be called with the desired CLI arguments.
"""
def _call_nominatim(*args):
return nominatim_db.cli.nominatim(osm2pgsql_path='OSM2PGSQL NOT AVAILABLE',
cli_args=args)
return nominatim_db.cli.nominatim(cli_args=args)
return _call_nominatim

View File

@@ -2,7 +2,7 @@
#
# This file is part of Nominatim. (https://nominatim.org)
#
# Copyright (C) 2023 by the Nominatim developer community.
# Copyright (C) 2025 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Tests for replication command of command-line interface wrapper.
@@ -100,7 +100,8 @@ class TestCliReplication:
def test_replication_update_continuous_no_index(self):
assert self.call_nominatim('--no-index') == 1
def test_replication_update_once_no_index(self, update_mock):
def test_replication_update_once_no_index(self, update_mock, monkeypatch):
monkeypatch.setenv('NOMINATIM_OSM2PGSQL_BINARY', 'OSM2PGSQL NOT AVAILABLE')
assert self.call_nominatim('--once', '--no-index') == 0
assert str(update_mock.last_args[1]['osm2pgsql']).endswith('OSM2PGSQL NOT AVAILABLE')

View File

@@ -111,7 +111,6 @@ def table_factory(temp_db_conn):
@pytest.fixture
def def_config():
cfg = Configuration(None)
cfg.set_libdirs(osm2pgsql=None)
return cfg
@@ -120,7 +119,6 @@ def project_env(tmp_path):
projdir = tmp_path / 'project'
projdir.mkdir()
cfg = Configuration(projdir)
cfg.set_libdirs(osm2pgsql=None)
return cfg
@@ -211,7 +209,7 @@ def osmline_table(temp_db_with_extensions, table_factory):
def sql_preprocessor_cfg(tmp_path, table_factory, temp_db_with_extensions):
table_factory('country_name', 'partition INT', ((0, ), (1, ), (2, )))
cfg = Configuration(None)
cfg.set_libdirs(osm2pgsql=None, sql=tmp_path)
cfg.set_libdirs(sql=tmp_path)
return cfg