Version 1 (modified by patrickkidd, 5 years ago)

--

I recently received a request to get my rtmidi module working on windows, so i decided to try. The first problem I ran into was distutils complaining about not being set up to use the same compiler that python was built with. Considering I built my own python for work, I knew something was wrong. A little searching led me to the following patch by beaudrym:

 http://bugs.python.org/issue1425482

--- msvccompiler_ori.py	Sun Aug  7 17:50:38 2005
+++ msvccompiler_mod.py	Mon Feb  6 13:10:40 2006
@@ -126,7 +126,10 @@
         self.set_macro("FrameworkDir", net, "installroot")
         try:
             if version > 7.0:
-                self.set_macro("FrameworkSDKDir", net, "sdkinstallrootv1.1")
+				try:
+					self.set_macro("FrameworkSDKDir", net, "sdkinstallrootv1.1")
+				except KeyError:
+					self.set_macro("FrameworkSDKDir", net, "sdkinstallrootv2.0")
             else:
                 self.set_macro("FrameworkSDKDir", net, "sdkinstallroot")
         except KeyError, exc: #
@@ -552,10 +555,24 @@
         Return a list of strings.  The list will be empty if unable to
         access the registry or appropriate registry keys not found.
         """
-
         if not _can_read_reg:
             return []
 
+        if self.__version >= 8:
+			
+			# With .NET 8.0, the environment variables are not stored in the 
+			# registry anymore.  They are stored in a platform specific file
+			# under C:\Program Files\Microsoft Visual Studio 8\VC\vcpackages\
+			# Instead of parsing these files (which I don't know how to do),
+			# we simply rely on the fact that the python script is being 
+			# called from a "Visual Studio 2005 Command Prompt".  In these
+			# consoles, the environment variables are properly defined.
+			
+			real_path = path
+			if path == "library":
+				real_path = "lib";
+			return string.split(os.environ[real_path], ";")
+			
         path = path + " dirs"
         if self.__version >= 7:
             key = (r"%s\%0.1f\VC\VC_OBJECTS_PLATFORM_INFO\Win32\Directories"

Attachments