Index: Lib/distutils/msvc9compiler.py =================================================================== --- Lib/distutils/msvc9compiler.py (revision 82816) +++ Lib/distutils/msvc9compiler.py (working copy) @@ -216,7 +216,7 @@ newVariable = os.pathsep.join(newList) return newVariable -def find_vcvarsall(version): +def find_vcvarsall(version, arch="x86"): """Find the vcvarsall.bat file At first it tries to find the productdir of VS 2008 in the registry. If @@ -254,6 +254,21 @@ if not productdir: log.debug("No productdir found") return None + + # This file is not present in the Express version. + f = os.path.join(productdir, "bin\\amd64\\vcvarsamd64.bat") + if arch in ["amd64", "x86_amd64", "x86_ia64"] and not os.path.isfile(f): + # Visual Studio Express with SDK 64-bit tools, workaround + # for broken paths in vcvarsall.bat. + path = "bin\\vcvars64.bat" + if arch != "amd64": + path = "bin\\vcvars" + arch + ".bat" + f = os.path.join(productdir, path) + if not os.path.isfile(f): + raise DistutilsPlatformError("Visual Studio Express: need 64-bit " + "tools from the SDK") + return f + vcvarsall = os.path.join(productdir, "vcvarsall.bat") if os.path.isfile(vcvarsall): return vcvarsall @@ -263,7 +278,7 @@ def query_vcvarsall(version, arch="x86"): """Launch vcvarsall.bat and read the settings from its environment """ - vcvarsall = find_vcvarsall(version) + vcvarsall = find_vcvarsall(version, arch) interesting = set(("include", "lib", "libpath", "path")) result = {} Index: Lib/distutils/tests/test_msvc9compiler.py =================================================================== --- Lib/distutils/tests/test_msvc9compiler.py (revision 82816) +++ Lib/distutils/tests/test_msvc9compiler.py (working copy) @@ -73,7 +73,7 @@ # this test is only for MSVC8.0 or above return from distutils.msvc9compiler import query_vcvarsall - def _find_vcvarsall(version): + def _find_vcvarsall(version, arch="x86"): return None from distutils import msvc9compiler