From: Sarah Hoffmann Date: Sat, 18 May 2024 17:35:18 +0000 (+0200) Subject: adapt plugin imports X-Git-Tag: deploy~4^2~15^2~20 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/dc7c11a9d1320965505ba18725466b0e9a648fde?hp=44fface92a52e5972cafaf93d7a46e23626de1a0 adapt plugin imports --- diff --git a/src/nominatim_api/search/query_analyzer_factory.py b/src/nominatim_api/search/query_analyzer_factory.py index ec8154ef..e10d7a7a 100644 --- a/src/nominatim_api/search/query_analyzer_factory.py +++ b/src/nominatim_api/search/query_analyzer_factory.py @@ -49,6 +49,6 @@ async def make_query_analyzer(conn: SearchConnection) -> AbstractQueryAnalyzer: log().comment(f"No tokenizer named '{name}' available. Database not set up properly.") raise RuntimeError('Tokenizer not found') - module = importlib.import_module(f'nominatim.api.search.{name}_tokenizer') + module = importlib.import_module(f'nominatim_api.api.search.{name}_tokenizer') return cast(AbstractQueryAnalyzer, await module.create_query_analyzer(conn)) diff --git a/src/nominatim_core/paths.py b/src/nominatim_core/paths.py index aa289708..7cdd3678 100644 --- a/src/nominatim_core/paths.py +++ b/src/nominatim_core/paths.py @@ -9,7 +9,7 @@ Path settings for extra data used by Nominatim. """ from pathlib import Path -PHPLIB_DIR = (Path(__file__) / '..' / '..' / '..' / 'lib-php').resolve() +PHPLIB_DIR = None SQLLIB_DIR = (Path(__file__) / '..' / '..' / '..' / 'lib-sql').resolve() DATA_DIR = (Path(__file__) / '..' / '..' / '..' / 'data').resolve() CONFIG_DIR = (Path(__file__) / '..' / '..' / '..' / 'settings').resolve() diff --git a/src/nominatim_db/cli.py b/src/nominatim_db/cli.py index 548f1165..7b55566c 100644 --- a/src/nominatim_db/cli.py +++ b/src/nominatim_db/cli.py @@ -180,7 +180,7 @@ class AdminServe: else: port = 8088 - server_module = importlib.import_module(f'nominatim.server.{args.engine}.server') + server_module = importlib.import_module(f'nominatim_db.server.{args.engine}.server') app = server_module.get_application(args.project_dir) uvicorn.run(app, host=host, port=port) diff --git a/src/nominatim_db/tokenizer/factory.py b/src/nominatim_db/tokenizer/factory.py index d43929f0..1193f499 100644 --- a/src/nominatim_db/tokenizer/factory.py +++ b/src/nominatim_db/tokenizer/factory.py @@ -41,7 +41,7 @@ def _import_tokenizer(name: str) -> TokenizerModule: "Check the setting of NOMINATIM_TOKENIZER.", name) raise UsageError('Tokenizer not found') - return importlib.import_module('nominatim.tokenizer.' + name + '_tokenizer') + return importlib.import_module('nominatim_db.tokenizer.' + name + '_tokenizer') def create_tokenizer(config: Configuration, init_db: bool = True, diff --git a/src/nominatim_db/tokenizer/icu_rule_loader.py b/src/nominatim_db/tokenizer/icu_rule_loader.py index 9e7f00b4..500683e5 100644 --- a/src/nominatim_db/tokenizer/icu_rule_loader.py +++ b/src/nominatim_db/tokenizer/icu_rule_loader.py @@ -184,7 +184,7 @@ class TokenAnalyzerRule: raise UsageError("'analyzer' parameter needs to be simple string") self._analysis_mod: AnalysisModule = \ - config.load_plugin_module(analyzer_name, 'nominatim.tokenizer.token_analysis') + config.load_plugin_module(analyzer_name, 'nominatim_db.tokenizer.token_analysis') self.config = self._analysis_mod.configure(rules, normalizer, transliterator) diff --git a/src/nominatim_db/tokenizer/place_sanitizer.py b/src/nominatim_db/tokenizer/place_sanitizer.py index da41692b..546d0da3 100644 --- a/src/nominatim_db/tokenizer/place_sanitizer.py +++ b/src/nominatim_db/tokenizer/place_sanitizer.py @@ -35,7 +35,7 @@ class PlaceSanitizer: raise UsageError("'step' attribute must be a simple string.") module: SanitizerHandler = \ - config.load_plugin_module(func['step'], 'nominatim.tokenizer.sanitizers') + config.load_plugin_module(func['step'], 'nominatim_db.tokenizer.sanitizers') self.handlers.append(module.create(SanitizerConfig(func)))