No longer used now that legacy tokenizer is gone.
from nominatim_db import cli
-exit(cli.nominatim(module_dir=None, osm2pgsql_path=None))
+exit(cli.nominatim(osm2pgsql_path=None))
# 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.
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))
self.project_dir = None
class _LibDirs:
- module: Path
osm2pgsql: Path
sql = paths.SQLLIB_DIR
data = paths.DATA_DIR
"""
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()
'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'
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)
@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')
@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)
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
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),
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']),
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):
@pytest.fixture
def def_config():
cfg = Configuration(None)
- cfg.set_libdirs(module='.', osm2pgsql='.')
+ cfg.set_libdirs(osm2pgsql=None)
return cfg
projdir = tmp_path / 'project'
projdir.mkdir()
cfg = Configuration(projdir)
- cfg.set_libdirs(module='.', osm2pgsql='.')
+ cfg.set_libdirs(osm2pgsql=None)
return cfg
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