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

Function build_osmtools

tools/python/maps_generator/generator/osmtools.py:9–39  ·  view source on GitHub ↗
(path, output=subprocess.DEVNULL, error=subprocess.DEVNULL)

Source from the content-addressed store, hash-verified

7
8
9def build_osmtools(path, output=subprocess.DEVNULL, error=subprocess.DEVNULL):
10 src = {
11 settings.OSM_TOOL_UPDATE: "osmupdate.c",
12 settings.OSM_TOOL_FILTER: "osmfilter.c",
13 settings.OSM_TOOL_CONVERT: "osmconvert.c",
14 }
15 ld_flags = ("-lz",)
16 cc = []
17 result = {}
18 for executable, src in src.items():
19 out = os.path.join(settings.OSM_TOOLS_PATH, executable)
20 op = [
21 settings.OSM_TOOLS_CC,
22 *settings.OSM_TOOLS_CC_FLAGS,
23 "-o",
24 out,
25 os.path.join(path, src),
26 *ld_flags,
27 ]
28 s = subprocess.Popen(op, stdout=output, stderr=error)
29 cc.append(s)
30 result[executable] = out
31
32 messages = []
33 for c in cc:
34 if c.wait() != os.EX_OK:
35 messages.append(f"The launch of {' '.join(c.args)} failed.")
36 if messages:
37 raise BadExitStatusError("\n".join(messages))
38
39 return result
40
41
42def osmconvert(

Callers 1

setup_osm_toolsMethod · 0.90

Calls 4

BadExitStatusErrorClass · 0.90
waitMethod · 0.80
joinMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected