MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / scan_setup_py

Function scan_setup_py

versioneer.py:2133–2167  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

2131
2132
2133def scan_setup_py():
2134 """Validate the contents of setup.py against Versioneer's expectations."""
2135 found = set()
2136 setters = False
2137 errors = 0
2138 with open("setup.py", "r") as f:
2139 for line in f.readlines():
2140 if "import versioneer" in line:
2141 found.add("import")
2142 if "versioneer.get_cmdclass()" in line:
2143 found.add("cmdclass")
2144 if "versioneer.get_version()" in line:
2145 found.add("get_version")
2146 if "versioneer.VCS" in line:
2147 setters = True
2148 if "versioneer.versionfile_source" in line:
2149 setters = True
2150 if len(found) != 3:
2151 print("")
2152 print("Your setup.py appears to be missing some important items")
2153 print("(but I might be wrong). Please make sure it has something")
2154 print("roughly like the following:")
2155 print("")
2156 print(" import versioneer")
2157 print(" setup( version=versioneer.get_version(),")
2158 print(" cmdclass=versioneer.get_cmdclass(), ...)")
2159 print("")
2160 errors += 1
2161 if setters:
2162 print("You should remove lines like 'versioneer.VCS = ' and")
2163 print("'versioneer.versionfile_source = ' . This configuration")
2164 print("now lives in setup.cfg, and should be removed from setup.py")
2165 print("")
2166 errors += 1
2167 return errors
2168
2169
2170if __name__ == "__main__":

Callers 1

versioneer.pyFile · 0.85

Calls 1

addMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…