MCPcopy Create free account
hub / github.com/comaps/comaps / init

Function init

tools/python/maps_generator/generator/settings.py:183–343  ·  view source on GitHub ↗
(default_settings_path: AnyStr)

Source from the content-addressed store, hash-verified

181
182
183def init(default_settings_path: AnyStr):
184 # Try to read a config and to overload default settings
185 cfg = CfgReader(default_settings_path)
186
187 # Main section:
188 global DEBUG
189 global TMPDIR
190 global MAIN_OUT_PATH
191 global CACHE_PATH
192 _DEBUG = cfg.get_opt("Main", "DEBUG")
193 DEBUG = DEBUG if _DEBUG is None else int(_DEBUG)
194 TMPDIR = cfg.get_opt_path("Main", "TMPDIR", TMPDIR)
195 MAIN_OUT_PATH = cfg.get_opt_path("Main", "MAIN_OUT_PATH", MAIN_OUT_PATH)
196 global PUBLISH_PATH
197 PUBLISH_PATH = cfg.get_opt_path("Main", "PUBLISH_PATH", PUBLISH_PATH)
198 global PUBLISH_KEY_PUBLIC
199 PUBLISH_KEY_PUBLIC = cfg.get_opt_path("Main", "PUBLISH_KEY_PUBLIC", PUBLISH_KEY_PUBLIC)
200 global PUBLISH_KEY_SECRET
201 PUBLISH_KEY_SECRET = cfg.get_opt_path("Main", "PUBLISH_KEY_SECRET", PUBLISH_KEY_SECRET)
202 CACHE_PATH = cfg.get_opt_path("Main", "CACHE_PATH", CACHE_PATH)
203
204 # Developer section:
205 global BUILD_PATH
206 global OMIM_PATH
207 BUILD_PATH = cfg.get_opt_path("Developer", "BUILD_PATH", BUILD_PATH)
208 OMIM_PATH = cfg.get_opt_path("Developer", "OMIM_PATH", OMIM_PATH)
209
210 # Osm tools section:
211 global OSM_TOOLS_SRC_PATH
212 global OSM_TOOLS_PATH
213 OSM_TOOLS_SRC_PATH = cfg.get_opt_path(
214 "Osm tools", "OSM_TOOLS_SRC_PATH", OSM_TOOLS_SRC_PATH
215 )
216 OSM_TOOLS_PATH = cfg.get_opt_path("Osm tools", "OSM_TOOLS_PATH", OSM_TOOLS_PATH)
217
218 # Generator tool section:
219 global USER_RESOURCE_PATH
220 global NODE_STORAGE
221 USER_RESOURCE_PATH = cfg.get_opt_path(
222 "Generator tool", "USER_RESOURCE_PATH", USER_RESOURCE_PATH
223 )
224 NODE_STORAGE = cfg.get_opt("Generator tool", "NODE_STORAGE", NODE_STORAGE)
225
226 assert os.path.exists(OMIM_PATH) is True, f"Can't find OMIM_PATH (set to {OMIM_PATH})"
227
228 if not os.path.exists(USER_RESOURCE_PATH):
229 from data_files import find_data_files
230
231 USER_RESOURCE_PATH = find_data_files("omim-data")
232 assert USER_RESOURCE_PATH is not None
233
234 import borders
235
236 # Issue: If maps_generator is installed in your system as a system
237 # package and borders.init() is called first time, call borders.init()
238 # might return False, because you need root permission.
239 assert borders.init()
240

Callers

nothing calls this directly

Calls 7

get_optMethod · 0.95
get_opt_pathMethod · 0.95
find_data_filesFunction · 0.90
md5_extFunction · 0.90
CfgReaderClass · 0.85
initMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected