mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-26 11:08:13 +00:00
move lua scripts into a separate directory
This commit is contained in:
5
.github/workflows/ci-tests.yml
vendored
5
.github/workflows/ci-tests.yml
vendored
@@ -185,9 +185,6 @@ jobs:
|
|||||||
- name: Prepare import environment
|
- name: Prepare import environment
|
||||||
run: |
|
run: |
|
||||||
mv Nominatim/test/testdb/apidb-test-data.pbf test.pbf
|
mv Nominatim/test/testdb/apidb-test-data.pbf test.pbf
|
||||||
mv Nominatim/settings/flex-base.lua flex-base.lua
|
|
||||||
mv Nominatim/settings/import-extratags.lua import-extratags.lua
|
|
||||||
mv Nominatim/settings/taginfo.lua taginfo.lua
|
|
||||||
rm -rf Nominatim
|
rm -rf Nominatim
|
||||||
mkdir data-env-reverse
|
mkdir data-env-reverse
|
||||||
working-directory: /home/nominatim
|
working-directory: /home/nominatim
|
||||||
@@ -205,7 +202,7 @@ jobs:
|
|||||||
working-directory: /home/nominatim/nominatim-project
|
working-directory: /home/nominatim/nominatim-project
|
||||||
|
|
||||||
- name: Print taginfo
|
- name: Print taginfo
|
||||||
run: lua taginfo.lua
|
run: lua ./nominatim-venv/lib/*/site-packages/nominatim_db/resources/lib-lua/taginfo.lua
|
||||||
working-directory: /home/nominatim
|
working-directory: /home/nominatim
|
||||||
|
|
||||||
- name: Collect host OS information
|
- name: Collect host OS information
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ osm2pgsql = {}
|
|||||||
function osm2pgsql.define_table(...) end
|
function osm2pgsql.define_table(...) end
|
||||||
|
|
||||||
-- provide path to flex-style lua file
|
-- provide path to flex-style lua file
|
||||||
flex = require('import-extratags')
|
package.path = arg[0]:match("(.*/)") .. "?.lua;" .. package.path
|
||||||
|
local flex = require('import-extratags')
|
||||||
local json = require ('dkjson')
|
local json = require ('dkjson')
|
||||||
|
|
||||||
|
|
||||||
@@ -11,4 +11,5 @@ from pathlib import Path
|
|||||||
|
|
||||||
DATA_DIR = None
|
DATA_DIR = None
|
||||||
SQLLIB_DIR = None
|
SQLLIB_DIR = None
|
||||||
|
LUALIB_DIR = None
|
||||||
CONFIG_DIR = (Path(__file__) / '..' / 'resources' / 'settings').resolve()
|
CONFIG_DIR = (Path(__file__) / '..' / 'resources' / 'settings').resolve()
|
||||||
|
|||||||
@@ -11,4 +11,5 @@ from pathlib import Path
|
|||||||
|
|
||||||
DATA_DIR = (Path(__file__) / '..' / 'resources').resolve()
|
DATA_DIR = (Path(__file__) / '..' / 'resources').resolve()
|
||||||
SQLLIB_DIR = (DATA_DIR / 'lib-sql')
|
SQLLIB_DIR = (DATA_DIR / 'lib-sql')
|
||||||
|
LUALIB_DIR = (DATA_DIR / 'lib-lua')
|
||||||
CONFIG_DIR = (DATA_DIR / 'settings')
|
CONFIG_DIR = (DATA_DIR / 'settings')
|
||||||
|
|||||||
1
packaging/nominatim-db/lib-lua
Symbolic link
1
packaging/nominatim-db/lib-lua
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../../lib-lua
|
||||||
@@ -44,6 +44,7 @@ include = [
|
|||||||
"src/nominatim_db",
|
"src/nominatim_db",
|
||||||
"scripts",
|
"scripts",
|
||||||
"lib-sql/**/*.sql",
|
"lib-sql/**/*.sql",
|
||||||
|
"lib-lua/**/*.lua",
|
||||||
"settings",
|
"settings",
|
||||||
"data/words.sql",
|
"data/words.sql",
|
||||||
"extra_src/nominatim_db/paths.py"
|
"extra_src/nominatim_db/paths.py"
|
||||||
@@ -65,6 +66,7 @@ packages = ["src/nominatim_db"]
|
|||||||
|
|
||||||
[tool.hatch.build.targets.wheel.force-include]
|
[tool.hatch.build.targets.wheel.force-include]
|
||||||
"lib-sql" = "nominatim_db/resources/lib-sql"
|
"lib-sql" = "nominatim_db/resources/lib-sql"
|
||||||
|
"lib-lua" = "nominatim_db/resources/lib-lua"
|
||||||
"settings" = "nominatim_db/resources/settings"
|
"settings" = "nominatim_db/resources/settings"
|
||||||
"data/country_osm_grid.sql.gz" = "nominatim_db/resources/country_osm_grid.sql.gz"
|
"data/country_osm_grid.sql.gz" = "nominatim_db/resources/country_osm_grid.sql.gz"
|
||||||
"data/words.sql" = "nominatim_db/resources/words.sql"
|
"data/words.sql" = "nominatim_db/resources/words.sql"
|
||||||
|
|||||||
@@ -189,7 +189,7 @@ class NominatimArgs:
|
|||||||
return dict(osm2pgsql=self.config.OSM2PGSQL_BINARY or self.config.lib_dir.osm2pgsql,
|
return dict(osm2pgsql=self.config.OSM2PGSQL_BINARY or self.config.lib_dir.osm2pgsql,
|
||||||
osm2pgsql_cache=self.osm2pgsql_cache or default_cache,
|
osm2pgsql_cache=self.osm2pgsql_cache or default_cache,
|
||||||
osm2pgsql_style=self.config.get_import_style_file(),
|
osm2pgsql_style=self.config.get_import_style_file(),
|
||||||
osm2pgsql_style_path=self.config.config_dir,
|
osm2pgsql_style_path=self.config.lib_dir.lua,
|
||||||
threads=self.threads or default_threads,
|
threads=self.threads or default_threads,
|
||||||
dsn=self.config.get_libpq_dsn(),
|
dsn=self.config.get_libpq_dsn(),
|
||||||
flatnode_file=str(self.config.get_path('FLATNODE_FILE') or ''),
|
flatnode_file=str(self.config.get_path('FLATNODE_FILE') or ''),
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ class Configuration:
|
|||||||
class _LibDirs:
|
class _LibDirs:
|
||||||
osm2pgsql: Path
|
osm2pgsql: Path
|
||||||
sql = paths.SQLLIB_DIR
|
sql = paths.SQLLIB_DIR
|
||||||
|
lua = paths.LUALIB_DIR
|
||||||
data = paths.DATA_DIR
|
data = paths.DATA_DIR
|
||||||
|
|
||||||
self.lib_dir = _LibDirs()
|
self.lib_dir = _LibDirs()
|
||||||
@@ -207,7 +208,7 @@ class Configuration:
|
|||||||
style = getattr(self, 'IMPORT_STYLE')
|
style = getattr(self, 'IMPORT_STYLE')
|
||||||
|
|
||||||
if style in ('admin', 'street', 'address', 'full', 'extratags'):
|
if style in ('admin', 'street', 'address', 'full', 'extratags'):
|
||||||
return self.config_dir / f'import-{style}.lua'
|
return self.lib_dir.lua / f'import-{style}.lua'
|
||||||
|
|
||||||
return self.find_config_file('', 'IMPORT_STYLE')
|
return self.find_config_file('', 'IMPORT_STYLE')
|
||||||
|
|
||||||
|
|||||||
@@ -10,5 +10,6 @@ Path settings for extra data used by Nominatim.
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
SQLLIB_DIR = (Path(__file__) / '..' / '..' / '..' / 'lib-sql').resolve()
|
SQLLIB_DIR = (Path(__file__) / '..' / '..' / '..' / 'lib-sql').resolve()
|
||||||
|
LUALIB_DIR = (Path(__file__) / '..' / '..' / '..' / 'lib-lua').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()
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ def get_osm2pgsql_options(nominatim_env, fname, append):
|
|||||||
osm2pgsql='osm2pgsql',
|
osm2pgsql='osm2pgsql',
|
||||||
osm2pgsql_cache=50,
|
osm2pgsql_cache=50,
|
||||||
osm2pgsql_style=str(nominatim_env.get_test_config().get_import_style_file()),
|
osm2pgsql_style=str(nominatim_env.get_test_config().get_import_style_file()),
|
||||||
osm2pgsql_style_path=nominatim_env.get_test_config().config_dir,
|
osm2pgsql_style_path=nominatim_env.get_test_config().lib_dir.lua,
|
||||||
threads=1,
|
threads=1,
|
||||||
dsn=nominatim_env.get_libpq_dsn(),
|
dsn=nominatim_env.get_libpq_dsn(),
|
||||||
flatnode_file='',
|
flatnode_file='',
|
||||||
|
|||||||
@@ -222,7 +222,7 @@ def test_get_import_style_intern(make_config, src_dir, monkeypatch):
|
|||||||
|
|
||||||
monkeypatch.setenv('NOMINATIM_IMPORT_STYLE', 'street')
|
monkeypatch.setenv('NOMINATIM_IMPORT_STYLE', 'street')
|
||||||
|
|
||||||
expected = src_dir / 'settings' / 'import-street.lua'
|
expected = src_dir / 'lib-lua' / 'import-street.lua'
|
||||||
|
|
||||||
assert config.get_import_style_file() == expected
|
assert config.get_import_style_file() == expected
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user