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.
()
| 141 | return s |
| 142 | |
| 143 | def 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 | |
| 168 | def get_build_architecture(): |
| 169 | """Return the processor architecture. |
no test coverage detected
searching dependent graphs…