Build a dict that maps paths to modules
(path)
| 25 | |
| 26 | |
| 27 | def 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 | |
| 49 | def FindGroups(path): |
no outgoing calls
no test coverage detected