Launch vcvarsall.bat and read the settings from its environment
(version, arch="x86")
| 248 | return None |
| 249 | |
| 250 | def query_vcvarsall(version, arch="x86"): |
| 251 | """Launch vcvarsall.bat and read the settings from its environment |
| 252 | """ |
| 253 | vcvarsall = find_vcvarsall(version) |
| 254 | interesting = {"include", "lib", "libpath", "path"} |
| 255 | result = {} |
| 256 | |
| 257 | if vcvarsall is None: |
| 258 | raise DistutilsPlatformError("Unable to find vcvarsall.bat") |
| 259 | log.debug("Calling 'vcvarsall.bat %s' (version=%s)", arch, version) |
| 260 | popen = subprocess.Popen('"%s" %s & set' % (vcvarsall, arch), |
| 261 | stdout=subprocess.PIPE, |
| 262 | stderr=subprocess.PIPE) |
| 263 | try: |
| 264 | stdout, stderr = popen.communicate() |
| 265 | if popen.wait() != 0: |
| 266 | raise DistutilsPlatformError(stderr.decode("mbcs")) |
| 267 | |
| 268 | stdout = stdout.decode("mbcs") |
| 269 | for line in stdout.split("\n"): |
| 270 | line = Reg.convert_mbcs(line) |
| 271 | if '=' not in line: |
| 272 | continue |
| 273 | line = line.strip() |
| 274 | key, value = line.split('=', 1) |
| 275 | key = key.lower() |
| 276 | if key in interesting: |
| 277 | if value.endswith(os.pathsep): |
| 278 | value = value[:-1] |
| 279 | result[key] = removeDuplicates(value) |
| 280 | |
| 281 | finally: |
| 282 | popen.stdout.close() |
| 283 | popen.stderr.close() |
| 284 | |
| 285 | if len(result) != len(interesting): |
| 286 | raise ValueError(str(list(result.keys()))) |
| 287 | |
| 288 | return result |
| 289 | |
| 290 | # More globals |
| 291 | VERSION = get_build_version() |
nothing calls this directly
no test coverage detected
searching dependent graphs…