From b54ff7d7664eadf3fdf018622540d6fce835502e Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Sat, 21 Sep 2024 17:39:01 +0200 Subject: [PATCH] remove all references to a module path No longer used now that legacy tokenizer is gone. --- packaging/nominatim-db/scripts/nominatim | 2 +- settings/env.defaults | 6 ------ src/nominatim_db/cli.py | 3 +-- src/nominatim_db/config.py | 1 - src/nominatim_db/paths.py | 1 - test/bdd/environment.py | 1 - test/bdd/steps/nominatim_environment.py | 3 +-- test/python/api/test_export.py | 3 +-- test/python/api/test_warm.py | 3 +-- test/python/cli/conftest.py | 3 +-- test/python/config/test_config.py | 12 ++++++------ test/python/conftest.py | 6 +++--- 12 files changed, 15 insertions(+), 29 deletions(-) diff --git a/packaging/nominatim-db/scripts/nominatim b/packaging/nominatim-db/scripts/nominatim index 39e703dc..184ab4c6 100755 --- a/packaging/nominatim-db/scripts/nominatim +++ b/packaging/nominatim-db/scripts/nominatim @@ -2,4 +2,4 @@ from nominatim_db import cli -exit(cli.nominatim(module_dir=None, osm2pgsql_path=None)) +exit(cli.nominatim(osm2pgsql_path=None)) diff --git a/settings/env.defaults b/settings/env.defaults index 8aee4a0f..d3952af0 100644 --- a/settings/env.defaults +++ b/settings/env.defaults @@ -12,12 +12,6 @@ NOMINATIM_DATABASE_DSN="pgsql:dbname=nominatim" # Nominatim sets up read-only access for this user during installation. NOMINATIM_DATABASE_WEBUSER="www-data" -# Directory where to find the PostgreSQL server module. -# When empty the module is expected to be located in the 'module' subdirectory -# in the project directory. -# Changing this value requires to run 'nominatim refresh --functions'. -NOMINATIM_DATABASE_MODULE_PATH= - # Tokenizer used for normalizing and parsing queries and names. # The tokenizer is set up during import and cannot be changed afterwards # without a reimport. diff --git a/src/nominatim_db/cli.py b/src/nominatim_db/cli.py index 46c42904..8d8a07f7 100644 --- a/src/nominatim_db/cli.py +++ b/src/nominatim_db/cli.py @@ -111,8 +111,7 @@ class CommandlineParser: args.config = Configuration(args.project_dir, environ=kwargs.get('environ', os.environ)) - args.config.set_libdirs(module=kwargs['module_dir'], - osm2pgsql=kwargs['osm2pgsql_path']) + args.config.set_libdirs(osm2pgsql=kwargs['osm2pgsql_path']) log = logging.getLogger() log.warning('Using project directory: %s', str(args.project_dir)) diff --git a/src/nominatim_db/config.py b/src/nominatim_db/config.py index a34ec944..b220b5c7 100644 --- a/src/nominatim_db/config.py +++ b/src/nominatim_db/config.py @@ -72,7 +72,6 @@ class Configuration: self.project_dir = None class _LibDirs: - module: Path osm2pgsql: Path sql = paths.SQLLIB_DIR data = paths.DATA_DIR diff --git a/src/nominatim_db/paths.py b/src/nominatim_db/paths.py index aa289708..2614fa14 100644 --- a/src/nominatim_db/paths.py +++ b/src/nominatim_db/paths.py @@ -9,7 +9,6 @@ Path settings for extra data used by Nominatim. """ from pathlib import Path -PHPLIB_DIR = (Path(__file__) / '..' / '..' / '..' / 'lib-php').resolve() SQLLIB_DIR = (Path(__file__) / '..' / '..' / '..' / 'lib-sql').resolve() DATA_DIR = (Path(__file__) / '..' / '..' / '..' / 'data').resolve() CONFIG_DIR = (Path(__file__) / '..' / '..' / '..' / 'settings').resolve() diff --git a/test/bdd/environment.py b/test/bdd/environment.py index a7135f38..7535c508 100644 --- a/test/bdd/environment.py +++ b/test/bdd/environment.py @@ -27,7 +27,6 @@ userconfig = { 'TEST_DB' : 'test_nominatim', 'API_TEST_DB' : 'test_api_nominatim', 'API_TEST_FILE' : TEST_BASE_DIR / 'testdb' / 'apidb-test-data.pbf', - 'SERVER_MODULE_PATH' : None, 'TOKENIZER' : None, # Test with a custom tokenizer 'STYLE' : 'extratags', 'API_ENGINE': 'falcon' diff --git a/test/bdd/steps/nominatim_environment.py b/test/bdd/steps/nominatim_environment.py index 1b0c7c5f..ba19bb48 100644 --- a/test/bdd/steps/nominatim_environment.py +++ b/test/bdd/steps/nominatim_environment.py @@ -266,8 +266,7 @@ class NominatimEnvironment: if self.website_dir is not None: cmdline = list(cmdline) + ['--project-dir', self.website_dir.name] - cli.nominatim(module_dir=None, - osm2pgsql_path=None, + cli.nominatim(osm2pgsql_path=None, cli_args=cmdline, environ=self.test_env) diff --git a/test/python/api/test_export.py b/test/python/api/test_export.py index 1d9bf90f..b0da52ce 100644 --- a/test/python/api/test_export.py +++ b/test/python/api/test_export.py @@ -14,8 +14,7 @@ import nominatim_db.cli @pytest.fixture def run_export(tmp_path, capsys): def _exec(args): - assert 0 == nominatim_db.cli.nominatim(module_dir='MODULE NOT AVAILABLE', - osm2pgsql_path='OSM2PGSQL NOT AVAILABLE', + assert 0 == nominatim_db.cli.nominatim(osm2pgsql_path='OSM2PGSQL NOT AVAILABLE', cli_args=['export', '--project-dir', str(tmp_path)] + args) return capsys.readouterr().out.split('\r\n') diff --git a/test/python/api/test_warm.py b/test/python/api/test_warm.py index 304943f1..f0c9986d 100644 --- a/test/python/api/test_warm.py +++ b/test/python/api/test_warm.py @@ -27,7 +27,6 @@ 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(module_dir='MODULE NOT AVAILABLE', - osm2pgsql_path='OSM2PGSQL NOT AVAILABLE', + assert 0 == nominatim_db.cli.nominatim(osm2pgsql_path='OSM2PGSQL NOT AVAILABLE', cli_args=['admin', '--project-dir', str(tmp_path), '--warm'] + args) diff --git a/test/python/cli/conftest.py b/test/python/cli/conftest.py index d5ade223..84f2d659 100644 --- a/test/python/cli/conftest.py +++ b/test/python/cli/conftest.py @@ -68,8 +68,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(module_dir='MODULE NOT AVAILABLE', - osm2pgsql_path='OSM2PGSQL NOT AVAILABLE', + return nominatim_db.cli.nominatim(osm2pgsql_path='OSM2PGSQL NOT AVAILABLE', cli_args=args) return _call_nominatim diff --git a/test/python/config/test_config.py b/test/python/config/test_config.py index 5c9393ec..8f90b5da 100644 --- a/test/python/config/test_config.py +++ b/test/python/config/test_config.py @@ -140,8 +140,8 @@ def test_get_bool(make_config, monkeypatch, value, result): def test_get_bool_empty(make_config): config = make_config() - assert config.DATABASE_MODULE_PATH == '' - assert not config.get_bool('DATABASE_MODULE_PATH') + assert config.TOKENIZER_CONFIG == '' + assert not config.get_bool('TOKENIZER_CONFIG') @pytest.mark.parametrize("value,result", [('0', 0), ('1', 1), @@ -167,10 +167,10 @@ def test_get_int_bad_values(make_config, monkeypatch, value): def test_get_int_empty(make_config): config = make_config() - assert config.DATABASE_MODULE_PATH == '' + assert config.TOKENIZER_CONFIG == '' with pytest.raises(UsageError): - config.get_int('DATABASE_MODULE_PATH') + config.get_int('TOKENIZER_CONFIG') @pytest.mark.parametrize("value,outlist", [('sd', ['sd']), @@ -193,8 +193,8 @@ def test_get_str_list_empty(make_config): def test_get_path_empty(make_config): config = make_config() - assert config.DATABASE_MODULE_PATH == '' - assert not config.get_path('DATABASE_MODULE_PATH') + assert config.TOKENIZER_CONFIG == '' + assert not config.get_path('TOKENIZER_CONFIG') def test_get_path_absolute(make_config, monkeypatch): diff --git a/test/python/conftest.py b/test/python/conftest.py index 3ced3205..a25ff8ec 100644 --- a/test/python/conftest.py +++ b/test/python/conftest.py @@ -109,7 +109,7 @@ def table_factory(temp_db_conn): @pytest.fixture def def_config(): cfg = Configuration(None) - cfg.set_libdirs(module='.', osm2pgsql='.') + cfg.set_libdirs(osm2pgsql=None) return cfg @@ -118,7 +118,7 @@ def project_env(tmp_path): projdir = tmp_path / 'project' projdir.mkdir() cfg = Configuration(projdir) - cfg.set_libdirs(module='.', osm2pgsql='.') + cfg.set_libdirs(osm2pgsql=None) return cfg @@ -208,7 +208,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(module='.', osm2pgsql='.', sql=tmp_path) + cfg.set_libdirs(osm2pgsql=None, sql=tmp_path) return cfg -- 2.39.5