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

Function get_build_version

Tools/c-analyzer/distutils/msvccompiler.py:143–166  ·  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

141 return s
142
143def get_build_version():
144 """Return the version of MSVC that was used to build Python.
145
146 For Python 2.3 and up, the version number is included in
147 sys.version. For earlier versions, assume the compiler is MSVC 6.
148 """
149 prefix = "MSC v."
150 i = sys.version.find(prefix)
151 if i == -1:
152 return 6
153 i = i + len(prefix)
154 s, rest = sys.version[i:].split(" ", 1)
155 majorVersion = int(s[:-2]) - 6
156 if majorVersion >= 13:
157 # v13 was skipped and should be v14
158 majorVersion += 1
159 minorVersion = int(s[2:3]) / 10.0
160 # I don't think paths are affected by minor version in version 6
161 if majorVersion == 6:
162 minorVersion = 0
163 if majorVersion >= 6:
164 return majorVersion + minorVersion
165 # else we don't know what version of the compiler this is
166 return None
167
168def get_build_architecture():
169 """Return the processor architecture.

Callers 2

__init__Method · 0.70
msvccompiler.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…