MCPcopy Create free account
hub / github.com/numpy/numpy / check_submodules

Function check_submodules

setup.py:129–148  ·  view source on GitHub ↗

verify that the submodules are checked out and clean use `git submodule update --init`; on failure

()

Source from the content-addressed store, hash-verified

127
128
129def check_submodules():
130 """ verify that the submodules are checked out and clean
131 use `git submodule update --init`; on failure
132 """
133 if not os.path.exists('.git'):
134 return
135 with open('.gitmodules') as f:
136 for line in f:
137 if 'path' in line:
138 p = line.split('=')[-1].strip()
139 if not os.path.exists(p):
140 raise ValueError('Submodule {} missing'.format(p))
141
142 proc = subprocess.Popen(['git', 'submodule', 'status'],
143 stdout=subprocess.PIPE)
144 status, _ = proc.communicate()
145 status = status.decode("ascii", "replace")
146 for line in status.splitlines():
147 if line.startswith('-') or line.startswith('+'):
148 raise ValueError('Submodule not clean: {}'.format(line))
149
150
151class concat_license_files():

Callers 1

runMethod · 0.85

Calls 7

openFunction · 0.85
stripMethod · 0.80
decodeMethod · 0.80
splitlinesMethod · 0.80
startswithMethod · 0.80
existsMethod · 0.45
splitMethod · 0.45

Tested by

no test coverage detected