Find the vcvarsall.bat file At first it tries to find the productdir of VS 2008 in the registry. If that fails it falls back to the VS90COMNTOOLS env var.
(version)
| 213 | return newVariable |
| 214 | |
| 215 | def find_vcvarsall(version): |
| 216 | """Find the vcvarsall.bat file |
| 217 | |
| 218 | At first it tries to find the productdir of VS 2008 in the registry. If |
| 219 | that fails it falls back to the VS90COMNTOOLS env var. |
| 220 | """ |
| 221 | vsbase = VS_BASE % version |
| 222 | try: |
| 223 | productdir = Reg.get_value(r"%s\Setup\VC" % vsbase, |
| 224 | "productdir") |
| 225 | except KeyError: |
| 226 | log.debug("Unable to find productdir in registry") |
| 227 | productdir = None |
| 228 | |
| 229 | if not productdir or not os.path.isdir(productdir): |
| 230 | toolskey = "VS%0.f0COMNTOOLS" % version |
| 231 | toolsdir = os.environ.get(toolskey, None) |
| 232 | |
| 233 | if toolsdir and os.path.isdir(toolsdir): |
| 234 | productdir = os.path.join(toolsdir, os.pardir, os.pardir, "VC") |
| 235 | productdir = os.path.abspath(productdir) |
| 236 | if not os.path.isdir(productdir): |
| 237 | log.debug("%s is not a valid directory" % productdir) |
| 238 | return None |
| 239 | else: |
| 240 | log.debug("Env var %s is not set or invalid" % toolskey) |
| 241 | if not productdir: |
| 242 | log.debug("No productdir found") |
| 243 | return None |
| 244 | vcvarsall = os.path.join(productdir, "vcvarsall.bat") |
| 245 | if os.path.isfile(vcvarsall): |
| 246 | return vcvarsall |
| 247 | log.debug("Unable to find vcvarsall.bat") |
| 248 | return None |
| 249 | |
| 250 | def query_vcvarsall(version, arch="x86"): |
| 251 | """Launch vcvarsall.bat and read the settings from its environment |