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

Function FindGroups

Utilities/JSON/JSONUpdateITKModules.py:49–68  ·  view source on GitHub ↗

Build a dict that maps paths to groups

(path)

Source from the content-addressed store, hash-verified

47
48
49def FindGroups(path):
50 """Build a dict that maps paths to groups"""
51
52 pathToGroups = dict()
53 fileProg = re.compile(r"itk-module.cmake")
54 moduleProg = re.compile(".*itk_module[^(]*\(([^ \n]*)", re.S)
55 for root, dirs, files in os.walk(path):
56 for f in files:
57 if fileProg.match(f):
58 fid = open(root + "/" + f, "r")
59 contents = fid.read()
60 m = moduleProg.match(contents)
61 if m:
62 groupName = os.path.basename(root)
63 parts = root.split("/")
64 pathToGroups[parts[len(parts) - 2] + parts[len(parts) - 1]] = (
65 groupName
66 )
67 fid.close()
68 return pathToGroups
69
70
71pathToITK = "/home/blowekamp/src/ITK"

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected