Get paths to submodules so that we can exclude them from things like check_test_name.py, check_unicode.py, etc.
()
| 3 | |
| 4 | |
| 5 | def get_submodule_paths(): |
| 6 | ''' |
| 7 | Get paths to submodules so that we can exclude them from things like |
| 8 | check_test_name.py, check_unicode.py, etc. |
| 9 | ''' |
| 10 | root_directory = os.path.dirname(os.path.dirname(__file__)) |
| 11 | gitmodule_file = os.path.join(root_directory, '.gitmodules') |
| 12 | with open(gitmodule_file) as gitmodules: |
| 13 | data = gitmodules.read().split('\n') |
| 14 | submodule_paths = [datum.split(' = ')[1] for datum in data if |
| 15 | datum.startswith('\tpath = ')] |
| 16 | submodule_paths = [os.path.join(root_directory, path) for path in |
| 17 | submodule_paths] |
| 18 | # vendored with a script rather than via gitmodules |
| 19 | with open( |
| 20 | os.path.join(root_directory, ".gitattributes"), "r" |
| 21 | ) as attr_file: |
| 22 | for line in attr_file: |
| 23 | if "vendored" in line: |
| 24 | pattern = line.split(" ", 1)[0] |
| 25 | submodule_paths.extend(glob.glob(pattern)) |
| 26 | |
| 27 | return submodule_paths |
| 28 | |
| 29 | |
| 30 | if __name__ == "__main__": |
no test coverage detected
searching dependent graphs…