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

Function main

tools/wheels/check_license.py:24–54  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

22
23
24def main():
25 p = argparse.ArgumentParser(usage=__doc__.rstrip())
26 p.add_argument("module", nargs="?", default="numpy")
27 args = p.parse_args()
28
29 # Drop '' from sys.path
30 sys.path.pop(0)
31
32 # Find module path
33 __import__(args.module)
34 mod = sys.modules[args.module]
35
36 # LICENSE.txt is installed in the .dist-info directory, so find it there
37 sitepkgs = pathlib.Path(mod.__file__).parent.parent
38 distinfo_path = [s for s in sitepkgs.glob("numpy-*.dist-info")][0]
39
40 # Check license text
41 license_txt = distinfo_path / "LICENSE.txt"
42 with open(license_txt, encoding="utf-8") as f:
43 text = f.read()
44
45 ok = check_text(text)
46 if not ok:
47 print(
48 "ERROR: License text {} does not contain expected "
49 "text fragments\n".format(license_txt)
50 )
51 print(text)
52 sys.exit(1)
53
54 sys.exit(0)
55
56
57if __name__ == "__main__":

Callers 1

check_license.pyFile · 0.70

Calls 5

openFunction · 0.85
check_textFunction · 0.85
printFunction · 0.85
rstripMethod · 0.80
readMethod · 0.45

Tested by

no test coverage detected