MCPcopy Create free account
hub / github.com/SimpleITK/SimpleITK / FindModules

Function FindModules

Utilities/JSON/JSONUpdateITKModules.py:27–46  ·  view source on GitHub ↗

Build a dict that maps paths to modules

(path)

Source from the content-addressed store, hash-verified

25
26
27def FindModules(path):
28 """Build a dict that maps paths to modules"""
29
30 pathToModule = dict()
31 fileProg = re.compile(r"itk-module.cmake")
32 moduleProg = re.compile(".*itk_module[^(]*\(([^ \n]*)", re.S)
33 for root, dirs, files in os.walk(path):
34 for f in files:
35 if fileProg.match(f):
36 fid = open(root + "/" + f, "r")
37 contents = fid.read()
38 m = moduleProg.match(contents)
39 if m:
40 moduleName = m.group(1)
41 parts = root.split("/")
42 pathToModule[parts[len(parts) - 2] + parts[len(parts) - 1]] = (
43 moduleName
44 )
45 fid.close()
46 return pathToModule
47
48
49def FindGroups(path):

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected