MCPcopy Create free account
hub / github.com/microsoft/debugpy / scan_setup_py

Function scan_setup_py

versioneer.py:2103–2137  ·  view source on GitHub ↗

Validate the contents of setup.py against Versioneer's expectations.

()

Source from the content-addressed store, hash-verified

2101
2102
2103def scan_setup_py():
2104 """Validate the contents of setup.py against Versioneer's expectations."""
2105 found = set()
2106 setters = False
2107 errors = 0
2108 with open("setup.py", "r") as f:
2109 for line in f.readlines():
2110 if "import versioneer" in line:
2111 found.add("import")
2112 if "versioneer.get_cmdclass()" in line:
2113 found.add("cmdclass")
2114 if "versioneer.get_version()" in line:
2115 found.add("get_version")
2116 if "versioneer.VCS" in line:
2117 setters = True
2118 if "versioneer.versionfile_source" in line:
2119 setters = True
2120 if len(found) != 3:
2121 print("")
2122 print("Your setup.py appears to be missing some important items")
2123 print("(but I might be wrong). Please make sure it has something")
2124 print("roughly like the following:")
2125 print("")
2126 print(" import versioneer")
2127 print(" setup( version=versioneer.get_version(),")
2128 print(" cmdclass=versioneer.get_cmdclass(), ...)")
2129 print("")
2130 errors += 1
2131 if setters:
2132 print("You should remove lines like 'versioneer.VCS = ' and")
2133 print("'versioneer.versionfile_source = ' . This configuration")
2134 print("now lives in setup.cfg, and should be removed from setup.py")
2135 print("")
2136 errors += 1
2137 return errors
2138
2139
2140if __name__ == "__main__":

Callers 1

versioneer.pyFile · 0.85

Calls 1

addMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…