[Python-checkins] python/dist/src/Lib/distutils msvccompiler.py,1.56,1.57
jhylton@users.sourceforge.net
jhylton@users.sourceforge.net
Thu, 17 Jul 2003 07:41:10 -0700
Update of /cvsroot/python/python/dist/src/Lib/distutils
In directory sc8-pr-cvs1:/tmp/cvs-serv16972/Lib/distutils
Modified Files:
msvccompiler.py
Log Message:
Patch from John Anderson to enable VC 7.1 support.
I tested against VC 7.0 and it caused no problems there.
Index: msvccompiler.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/distutils/msvccompiler.py,v
retrieving revision 1.56
retrieving revision 1.57
diff -C2 -d -r1.56 -r1.57
*** msvccompiler.py 14 May 2003 19:48:57 -0000 1.56
--- msvccompiler.py 17 Jul 2003 14:41:07 -0000 1.57
***************
*** 46,49 ****
--- 46,53 ----
except ImportError:
+ log.info("Warning: Can't read registry to find the "
+ "necessary compiler setting\n"
+ "Make sure that Python modules _winreg, "
+ "win32api or win32con are installed.")
pass
***************
*** 116,125 ****
def load_macros(self, version):
! vsbase = r"Software\Microsoft\VisualStudio\%s.0" % version
self.set_macro("VCInstallDir", vsbase + r"\Setup\VC", "productdir")
self.set_macro("VSInstallDir", vsbase + r"\Setup\VS", "productdir")
net = r"Software\Microsoft\.NETFramework"
self.set_macro("FrameworkDir", net, "installroot")
! self.set_macro("FrameworkSDKDir", net, "sdkinstallroot")
p = r"Software\Microsoft\NET Framework Setup\Product"
--- 120,132 ----
def load_macros(self, version):
! vsbase = r"Software\Microsoft\VisualStudio\%0.1f" % version
self.set_macro("VCInstallDir", vsbase + r"\Setup\VC", "productdir")
self.set_macro("VSInstallDir", vsbase + r"\Setup\VS", "productdir")
net = r"Software\Microsoft\.NETFramework"
self.set_macro("FrameworkDir", net, "installroot")
! if version > 7.0:
! self.set_macro("FrameworkSDKDir", net, "sdkinstallrootv1.1")
! else:
! self.set_macro("FrameworkSDKDir", net, "sdkinstallroot")
p = r"Software\Microsoft\NET Framework Setup\Product"
***************
*** 151,159 ****
i = i + len(prefix)
s, rest = sys.version[i:].split(" ", 1)
! n = int(s[:-2])
! if n == 12:
! return 6
! elif n == 13:
! return 7
# else we don't know what version of the compiler this is
return None
--- 158,168 ----
i = i + len(prefix)
s, rest = sys.version[i:].split(" ", 1)
! majorVersion = int(s[:-2]) - 6
! minorVersion = int(s[2:3]) / 10.0
! # I don't think paths are affected by minor version in version 6
! if majorVersion == 6:
! minorVersion = 0
! if majorVersion >= 6:
! return majorVersion + minorVersion
# else we don't know what version of the compiler this is
return None
***************
*** 193,197 ****
CCompiler.__init__ (self, verbose, dry_run, force)
self.__version = get_build_version()
! if self.__version == 7:
self.__root = r"Software\Microsoft\VisualStudio"
self.__macros = MacroExpander(self.__version)
--- 202,206 ----
CCompiler.__init__ (self, verbose, dry_run, force)
self.__version = get_build_version()
! if self.__version >= 7:
self.__root = r"Software\Microsoft\VisualStudio"
self.__macros = MacroExpander(self.__version)
***************
*** 200,203 ****
--- 209,218 ----
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")
***************
*** 519,525 ****
path = path + " dirs"
! if self.__version == 7:
! key = (r"%s\7.0\VC\VC_OBJECTS_PLATFORM_INFO\Win32\Directories"
! % (self.__root,))
else:
key = (r"%s\6.0\Build System\Components\Platforms"
--- 534,540 ----
path = path + " dirs"
! if self.__version >= 7:
! key = (r"%s\%0.1f\VC\VC_OBJECTS_PLATFORM_INFO\Win32\Directories"
! % (self.__root, self.__version))
else:
key = (r"%s\6.0\Build System\Components\Platforms"
***************
*** 529,533 ****
d = read_values(base, key)
if d:
! if self.__version == 7:
return string.split(self.__macros.sub(d[path]), ";")
else:
--- 544,548 ----
d = read_values(base, key)
if d:
! if self.__version >= 7:
return string.split(self.__macros.sub(d[path]), ";")
else: