()
| 22 | |
| 23 | |
| 24 | def 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 | |
| 57 | if __name__ == "__main__": |
no test coverage detected