forked from hans/Nominatim
add library directories to config
Allows to reduce the number of parameters in functions that take the config anyway.
This commit is contained in:
@@ -84,6 +84,11 @@ class CommandlineParser:
|
||||
|
||||
args.config = Configuration(args.project_dir, args.config_dir,
|
||||
environ=kwargs.get('environ', os.environ))
|
||||
args.config.set_libdirs(module=args.module_dir,
|
||||
osm2pgsql=args.osm2pgsql_path,
|
||||
php=args.phplib_dir,
|
||||
sql=args.sqllib_dir,
|
||||
data=args.data_dir)
|
||||
|
||||
log = logging.getLogger()
|
||||
log.warning('Using project directory: %s', str(args.project_dir))
|
||||
|
||||
@@ -39,6 +39,16 @@ class Configuration:
|
||||
self._config['NOMINATIM_ADDRESS_LEVEL_CONFIG'] = \
|
||||
str(config_dir / 'address-levels.json')
|
||||
|
||||
class _LibDirs: # pylint: disable=too-few-public-methods
|
||||
pass
|
||||
|
||||
self.lib_dir = _LibDirs()
|
||||
|
||||
def set_libdirs(self, **kwargs):
|
||||
""" Set paths to library functions and data.
|
||||
"""
|
||||
for key, value in kwargs.items():
|
||||
setattr(self.lib_dir, key, Path(value).resolve())
|
||||
|
||||
def __getattr__(self, name):
|
||||
name = 'NOMINATIM_' + name
|
||||
|
||||
Reference in New Issue
Block a user