File: get_submodule_paths.py

package info (click to toggle)
scipy 1.16.0-1exp7
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 234,820 kB
  • sloc: cpp: 503,145; python: 344,611; ansic: 195,638; javascript: 89,566; fortran: 56,210; cs: 3,081; f90: 1,150; sh: 848; makefile: 785; pascal: 284; csh: 135; lisp: 134; xml: 56; perl: 51
file content (23 lines) | stat: -rw-r--r-- 872 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import os


def get_submodule_paths():
    '''
    Get paths to submodules so that we can exclude them from things like
    check_test_name.py, check_unicode.py, etc.
    '''
    root_directory = os.path.dirname(os.path.dirname(__file__))
    gitmodule_file = os.path.join(root_directory, '.gitmodules')
    with open(gitmodule_file) as gitmodules:
        data = gitmodules.read().split('\n')
        submodule_paths = [datum.split(' = ')[1] for datum in data if
                        datum.startswith('\tpath = ')]
        submodule_paths = [os.path.join(root_directory, path) for path in
                           submodule_paths]
    # vendored with a script rather than via gitmodules
    submodule_paths.append(os.path.join(root_directory, 'scipy/_lib/pyprima'))
    return submodule_paths


if __name__ == "__main__":
    print('\n'.join(get_submodule_paths()))