(header)
| 93 | SOURCE_EXTENSIONS = ['.cpp', '.cxx', '.cc', '.c', '.m', '.mm'] |
| 94 | |
| 95 | def PotentialAlternatives(header): |
| 96 | dirname, filename = os.path.split(header) |
| 97 | basename, _ = os.path.splitext(filename) |
| 98 | |
| 99 | source_dirs = [dirname] |
| 100 | |
| 101 | if dirname.endswith(os.path.sep + 'include'): |
| 102 | # if we're in a folder 'include', also look in its parent |
| 103 | parent = os.path.abspath(os.path.join(dirname, os.path.pardir)) |
| 104 | source_dirs.append(parent) |
| 105 | # and ../src (used by lua dependency) |
| 106 | source_dirs.append(os.path.join(parent, 'src')) |
| 107 | |
| 108 | include_idx = dirname.rfind(os.path.sep + 'include' + os.path.sep) |
| 109 | if include_idx != -1: |
| 110 | # we're in a subfolder of a parent '/include/' |
| 111 | # .../include/subdir/path |
| 112 | # look in .../subdir/path |
| 113 | source_dirs.append( |
| 114 | dirname[:include_idx] + |
| 115 | os.path.sep + |
| 116 | dirname[include_idx + len('include') + 2*len(os.path.sep):] |
| 117 | ) |
| 118 | |
| 119 | for source_dir in source_dirs: |
| 120 | for ext in SOURCE_EXTENSIONS: |
| 121 | yield source_dir + os.path.sep + basename + ext |
| 122 | |
| 123 | |
| 124 | def GetCompilationInfoForFile(filename): |
no outgoing calls
no test coverage detected