diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2006-02-20 12:15:15 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2006-02-20 12:15:15 (GMT) |
commit | e46af8c367c5fb17be0391a07a534ba5007133e5 (patch) | |
tree | fe33c2245248c1f2e0977fe4e22ad3e672bd96cc /Lib | |
parent | 5771310a09640388066fd1747842035f0df2f8a5 (diff) | |
download | cpython-e46af8c367c5fb17be0391a07a534ba5007133e5.zip cpython-e46af8c367c5fb17be0391a07a534ba5007133e5.tar.gz cpython-e46af8c367c5fb17be0391a07a534ba5007133e5.tar.bz2 |
Let the SDK setup override distutils logic.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/distutils/msvccompiler.py | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/Lib/distutils/msvccompiler.py b/Lib/distutils/msvccompiler.py index 85d515b..b65e528 100644 --- a/Lib/distutils/msvccompiler.py +++ b/Lib/distutils/msvccompiler.py @@ -214,21 +214,31 @@ class MSVCCompiler (CCompiler) : self.initialized = False def initialize(self): - self.__paths = self.get_msvc_paths("path") - - if len (self.__paths) == 0: - raise DistutilsPlatformError, \ - ("Python was built with version %s of Visual Studio, " - "and extensions need to be built with the same " - "version of the compiler, but it isn't installed." % self.__version) - - self.cc = self.find_exe("cl.exe") - self.linker = self.find_exe("link.exe") - self.lib = self.find_exe("lib.exe") - self.rc = self.find_exe("rc.exe") # resource compiler - self.mc = self.find_exe("mc.exe") # message compiler - self.set_path_env_var('lib') - self.set_path_env_var('include') + self.__paths = [] + if os.environ.has_key("MSSdk") and self.find_exe("cl.exe"): + # Assume that the SDK set up everything alright; don't try to be + # smarter + self.cc = "cl.exe" + self.linker = "link.exe" + self.lib = "lib.exe" + self.rc = "rc.exe" + self.mc = "mc.exe" + else: + self.__paths = self.get_msvc_paths("path") + + if len (self.__paths) == 0: + raise DistutilsPlatformError, \ + ("Python was built with version %s of Visual Studio, " + "and extensions need to be built with the same " + "version of the compiler, but it isn't installed." % self.__version) + + self.cc = self.find_exe("cl.exe") + self.linker = self.find_exe("link.exe") + self.lib = self.find_exe("lib.exe") + self.rc = self.find_exe("rc.exe") # resource compiler + self.mc = self.find_exe("mc.exe") # message compiler + self.set_path_env_var('lib') + self.set_path_env_var('include') # extend the MSVC path with the current path try: |