MCPcopy Index your code
hub / github.com/numpy/numpy / check_requirements_files

Function check_requirements_files

tools/check_openblas_version.py:39–77  ·  view source on GitHub ↗
(reqfile)

Source from the content-addressed store, hash-verified

37
38
39def check_requirements_files(reqfile):
40 if not os.path.exists(reqfile):
41 print(f"Path does not exist: {reqfile}")
42
43 def get_version(line):
44 req = line.split(";")[0].split("==")[1].split(".")[:5]
45 return tuple(int(s) for s in req)
46
47 def parse_reqs(reqfile):
48 with open(reqfile) as f:
49 lines = f.readlines()
50
51 v32 = None
52 v64 = None
53 for line in lines:
54 if "scipy-openblas32" in line:
55 v32 = get_version(line)
56 if "scipy-openblas64" in line:
57 v64 = get_version(line)
58 if v32 is None or v64 is None:
59 raise AssertionError("Expected `scipy-openblas32` and "
60 "`scipy-openblas64` in `ci_requirements.txt`, "
61 f"got:\n {' '.join(lines)}")
62 return v32, v64
63
64 this_dir = os.path.abspath(os.path.dirname(__file__))
65 reqfile_thisrepo = os.path.join(this_dir, '..', 'requirements',
66 'ci_requirements.txt')
67
68 v32_thisrepo, v64_thisrepo = parse_reqs(reqfile_thisrepo)
69 v32_rel, v64_rel = parse_reqs(reqfile)
70
71 def compare_versions(v_rel, v_thisrepo, bits):
72 if not v_rel >= v_thisrepo:
73 raise AssertionError(f"`numpy-release` version of scipy-openblas{bits} "
74 f"{v_rel} is behind this repo: {v_thisrepo}")
75
76 compare_versions(v64_rel, v64_thisrepo, "64")
77 compare_versions(v32_rel, v32_thisrepo, "32")
78
79
80def main():

Callers 1

mainFunction · 0.85

Calls 5

parse_reqsFunction · 0.85
compare_versionsFunction · 0.85
joinMethod · 0.80
existsMethod · 0.45
abspathMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…