(plat_spec)
| 109 | return vcvarsall, None |
| 110 | |
| 111 | def _get_vc_env(plat_spec): |
| 112 | if os.getenv("DISTUTILS_USE_SDK"): |
| 113 | return { |
| 114 | key.lower(): value |
| 115 | for key, value in os.environ.items() |
| 116 | } |
| 117 | |
| 118 | vcvarsall, _ = _find_vcvarsall(plat_spec) |
| 119 | if not vcvarsall: |
| 120 | raise DistutilsPlatformError("Unable to find vcvarsall.bat") |
| 121 | |
| 122 | try: |
| 123 | out = subprocess.check_output( |
| 124 | 'cmd /u /c "{}" {} && set'.format(vcvarsall, plat_spec), |
| 125 | stderr=subprocess.STDOUT, |
| 126 | ).decode('utf-16le', errors='replace') |
| 127 | except subprocess.CalledProcessError as exc: |
| 128 | log.error(exc.output) |
| 129 | raise DistutilsPlatformError("Error executing {}" |
| 130 | .format(exc.cmd)) |
| 131 | |
| 132 | env = { |
| 133 | key.lower(): value |
| 134 | for key, _, value in |
| 135 | (line.partition('=') for line in out.splitlines()) |
| 136 | if key and value |
| 137 | } |
| 138 | |
| 139 | return env |
| 140 | |
| 141 | def _find_exe(exe, paths=None): |
| 142 | """Return path to an MSVC executable program. |
nothing calls this directly
no test coverage detected
searching dependent graphs…