MCPcopy Index your code
hub / github.com/python/cpython / get_build_version

Function get_build_version

Tools/c-analyzer/distutils/msvc9compiler.py:165–188  ·  view source on GitHub ↗

Return the version of MSVC that was used to build Python. For Python 2.3 and up, the version number is included in sys.version. For earlier versions, assume the compiler is MSVC 6.

()

Source from the content-addressed store, hash-verified

163 return s
164
165def get_build_version():
166 """Return the version of MSVC that was used to build Python.
167
168 For Python 2.3 and up, the version number is included in
169 sys.version. For earlier versions, assume the compiler is MSVC 6.
170 """
171 prefix = "MSC v."
172 i = sys.version.find(prefix)
173 if i == -1:
174 return 6
175 i = i + len(prefix)
176 s, rest = sys.version[i:].split(" ", 1)
177 majorVersion = int(s[:-2]) - 6
178 if majorVersion >= 13:
179 # v13 was skipped and should be v14
180 majorVersion += 1
181 minorVersion = int(s[2:3]) / 10.0
182 # I don't think paths are affected by minor version in version 6
183 if majorVersion == 6:
184 minorVersion = 0
185 if majorVersion >= 6:
186 return majorVersion + minorVersion
187 # else we don't know what version of the compiler this is
188 return None
189
190def normalize_and_reduce_paths(paths):
191 """Return a list of normalized paths with duplicates removed.

Callers 1

msvc9compiler.pyFile · 0.70

Calls 2

findMethod · 0.45
splitMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…