remove all references to a module path

No longer used now that legacy tokenizer is gone.
This commit is contained in:
Sarah Hoffmann
2024-09-21 17:39:01 +02:00
parent 9734bbf240
commit b54ff7d766
12 changed files with 15 additions and 29 deletions

View File

@@ -2,4 +2,4 @@
from nominatim_db import cli from nominatim_db import cli
exit(cli.nominatim(module_dir=None, osm2pgsql_path=None)) exit(cli.nominatim(osm2pgsql_path=None))

View File

@@ -12,12 +12,6 @@ NOMINATIM_DATABASE_DSN="pgsql:dbname=nominatim"
# Nominatim sets up read-only access for this user during installation. # Nominatim sets up read-only access for this user during installation.
NOMINATIM_DATABASE_WEBUSER="www-data" 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. # Tokenizer used for normalizing and parsing queries and names.
# The tokenizer is set up during import and cannot be changed afterwards # The tokenizer is set up during import and cannot be changed afterwards
# without a reimport. # without a reimport.

View File

@@ -111,8 +111,7 @@ class CommandlineParser:
args.config = Configuration(args.project_dir, args.config = Configuration(args.project_dir,
environ=kwargs.get('environ', os.environ)) environ=kwargs.get('environ', os.environ))
args.config.set_libdirs(module=kwargs['module_dir'], args.config.set_libdirs(osm2pgsql=kwargs['osm2pgsql_path'])
osm2pgsql=kwargs['osm2pgsql_path'])
log = logging.getLogger() log = logging.getLogger()
log.warning('Using project directory: %s', str(args.project_dir)) log.warning('Using project directory: %s', str(args.project_dir))

View File

@@ -72,7 +72,6 @@ class Configuration:
self.project_dir = None self.project_dir = None
class _LibDirs: class _LibDirs:
module: Path
osm2pgsql: Path osm2pgsql: Path
sql = paths.SQLLIB_DIR sql = paths.SQLLIB_DIR
data = paths.DATA_DIR data = paths.DATA_DIR

View File

@@ -9,7 +9,6 @@ Path settings for extra data used by Nominatim.
""" """
from pathlib import Path from pathlib import Path
PHPLIB_DIR = (Path(__file__) / '..' / '..' / '..' / 'lib-php').resolve()
SQLLIB_DIR = (Path(__file__) / '..' / '..' / '..' / 'lib-sql').resolve() SQLLIB_DIR = (Path(__file__) / '..' / '..' / '..' / 'lib-sql').resolve()
DATA_DIR = (Path(__file__) / '..' / '..' / '..' / 'data').resolve() DATA_DIR = (Path(__file__) / '..' / '..' / '..' / 'data').resolve()
CONFIG_DIR = (Path(__file__) / '..' / '..' / '..' / 'settings').resolve() CONFIG_DIR = (Path(__file__) / '..' / '..' / '..' / 'settings').resolve()

View File

@@ -27,7 +27,6 @@ userconfig = {
'TEST_DB' : 'test_nominatim', 'TEST_DB' : 'test_nominatim',
'API_TEST_DB' : 'test_api_nominatim', 'API_TEST_DB' : 'test_api_nominatim',
'API_TEST_FILE' : TEST_BASE_DIR / 'testdb' / 'apidb-test-data.pbf', 'API_TEST_FILE' : TEST_BASE_DIR / 'testdb' / 'apidb-test-data.pbf',
'SERVER_MODULE_PATH' : None,
'TOKENIZER' : None, # Test with a custom tokenizer 'TOKENIZER' : None, # Test with a custom tokenizer
'STYLE' : 'extratags', 'STYLE' : 'extratags',
'API_ENGINE': 'falcon' 'API_ENGINE': 'falcon'

View File

@@ -266,8 +266,7 @@ class NominatimEnvironment:
if self.website_dir is not None: if self.website_dir is not None:
cmdline = list(cmdline) + ['--project-dir', self.website_dir.name] cmdline = list(cmdline) + ['--project-dir', self.website_dir.name]
cli.nominatim(module_dir=None, cli.nominatim(osm2pgsql_path=None,
osm2pgsql_path=None,
cli_args=cmdline, cli_args=cmdline,
environ=self.test_env) environ=self.test_env)

View File

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

View File

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

View File

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

View File

@@ -140,8 +140,8 @@ def test_get_bool(make_config, monkeypatch, value, result):
def test_get_bool_empty(make_config): def test_get_bool_empty(make_config):
config = make_config() config = make_config()
assert config.DATABASE_MODULE_PATH == '' assert config.TOKENIZER_CONFIG == ''
assert not config.get_bool('DATABASE_MODULE_PATH') assert not config.get_bool('TOKENIZER_CONFIG')
@pytest.mark.parametrize("value,result", [('0', 0), ('1', 1), @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): def test_get_int_empty(make_config):
config = make_config() config = make_config()
assert config.DATABASE_MODULE_PATH == '' assert config.TOKENIZER_CONFIG == ''
with pytest.raises(UsageError): with pytest.raises(UsageError):
config.get_int('DATABASE_MODULE_PATH') config.get_int('TOKENIZER_CONFIG')
@pytest.mark.parametrize("value,outlist", [('sd', ['sd']), @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): def test_get_path_empty(make_config):
config = make_config() config = make_config()
assert config.DATABASE_MODULE_PATH == '' assert config.TOKENIZER_CONFIG == ''
assert not config.get_path('DATABASE_MODULE_PATH') assert not config.get_path('TOKENIZER_CONFIG')
def test_get_path_absolute(make_config, monkeypatch): def test_get_path_absolute(make_config, monkeypatch):

View File

@@ -109,7 +109,7 @@ def table_factory(temp_db_conn):
@pytest.fixture @pytest.fixture
def def_config(): def def_config():
cfg = Configuration(None) cfg = Configuration(None)
cfg.set_libdirs(module='.', osm2pgsql='.') cfg.set_libdirs(osm2pgsql=None)
return cfg return cfg
@@ -118,7 +118,7 @@ def project_env(tmp_path):
projdir = tmp_path / 'project' projdir = tmp_path / 'project'
projdir.mkdir() projdir.mkdir()
cfg = Configuration(projdir) cfg = Configuration(projdir)
cfg.set_libdirs(module='.', osm2pgsql='.') cfg.set_libdirs(osm2pgsql=None)
return cfg 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): def sql_preprocessor_cfg(tmp_path, table_factory, temp_db_with_extensions):
table_factory('country_name', 'partition INT', ((0, ), (1, ), (2, ))) table_factory('country_name', 'partition INT', ((0, ), (1, ), (2, )))
cfg = Configuration(None) cfg = Configuration(None)
cfg.set_libdirs(module='.', osm2pgsql='.', sql=tmp_path) cfg.set_libdirs(osm2pgsql=None, sql=tmp_path)
return cfg return cfg