()
| 553 | |
| 554 | @staticmethod |
| 555 | def setup_osm_tools() -> Dict[AnyStr, AnyStr]: |
| 556 | path = settings.OSM_TOOLS_PATH |
| 557 | osm_tool_names = [ |
| 558 | settings.OSM_TOOL_CONVERT, |
| 559 | settings.OSM_TOOL_UPDATE, |
| 560 | settings.OSM_TOOL_FILTER, |
| 561 | ] |
| 562 | |
| 563 | logger.info("Check for the osmctools binaries...") |
| 564 | |
| 565 | # Check in the configured path first. |
| 566 | tmp_paths = [os.path.join(path, t) for t in osm_tool_names] |
| 567 | if not all([is_executable(t) for t in tmp_paths]): |
| 568 | # Or use a system-wide installation. |
| 569 | tmp_paths = [shutil.which(t) for t in osm_tool_names] |
| 570 | if all([is_executable(t) for t in tmp_paths]): |
| 571 | osm_tool_paths = dict(zip(osm_tool_names, tmp_paths)) |
| 572 | logger.info(f"Found osmctools at {', '.join(osm_tool_paths.values())}") |
| 573 | return osm_tool_paths |
| 574 | |
| 575 | logger.info(f"osmctools are not found, building from the sources into {path}...") |
| 576 | os.makedirs(path, exist_ok=True) |
| 577 | return build_osmtools(settings.OSM_TOOLS_SRC_PATH) |
| 578 | |
| 579 | @staticmethod |
| 580 | def get_map_series() -> AnyStr: |
no test coverage detected