This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: More robust MSVC6 finder
Type: Stage:
Components: Distutils Versions: Python 2.3
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: jhylton Nosy List: gtk, jhylton, loewis, murraysteele, pmagwene
Priority: normal Keywords: patch

Created on 2003-07-31 12:50 by gtk, last changed 2022-04-10 16:10 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
msvccompiler.patch gtk, 2003-08-01 04:06 fixed msvccompiler.patch
Messages (8)
msg44370 - (view) Author: Garth T Kidd (gtk) Date: 2003-07-31 12:50
My VS6 install on XP didn't set the 
r"Software\Microsoft\Devstudio\6.0\Build System" 
registry key relied upon by distutils.msvccompiler to find 
the compiler and linker executable. 

As a backup to the registry paths, this patch looks up 
the MSVCDIR environment variable and ensures its 
basename is appropriate for the Python build version: 

            if self.__version == 6: 
                matchbase = 'vc98'
            elif self.__version == 7: 
                matchbase = 'vc7'

Works fine on my machine, so long as I run 
VCVARS32.BAT, and fails appropriately if I ran the wrong 
VCVARS32.BAT by mistake (I have Visual Studio Net 
2003 also installed). 

The patch should be applied to distutils/msvccompiler.py.
msg44371 - (view) Author: Garth T Kidd (gtk) Date: 2003-07-31 12:52
Logged In: YES 
user_id=59803

Whups. The patch didn't attach. 
msg44372 - (view) Author: Jeremy Hylton (jhylton) (Python triager) Date: 2003-07-31 22:09
Logged In: YES 
user_id=31392

I've desired the same functionality in the past.
msg44373 - (view) Author: Garth T Kidd (gtk) Date: 2003-08-01 04:06
Logged In: YES 
user_id=59803

WARNING: the first patch contains a typo. s/nstring/string/ 
and you'll be fine. New version attached. 
msg44374 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2003-08-01 07:16
Logged In: YES 
user_id=21627

I'm curious, though, how you installed VS6 without getting
the registry settings. Doesn't this mean your installation
of VS6 is broken?
msg44375 - (view) Author: Murray Steele (murraysteele) Date: 2003-10-21 11:10
Logged In: YES 
user_id=891425

Having come across this problem myself, it seems that MSVC 6
doesn't create the r"Software\Microsoft\Devstudio\6.0\Build
System" registry keys until *after* you run the actual
Visual Studio IDE.  So just doing a plain install and never
running the IDE isn't enough.

This isn't much of a fix, just some kind of documentation
incase it bites some other fumbling developer in the future.

Someone somewhere else
(http://sourceforge.net/tracker/?func=detail&atid=105470&aid=451285&group_id=5470)
 suggested using the Environment Variables as well as the
registry keys in distutils to check for compiler
correctness.  Seems like a plan to me. 

And there is some more chat about this problem here
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=614770&group_id=5470
msg44376 - (view) Author: Paul Magwene (pmagwene) Date: 2003-11-13 20:12
Logged In: YES 
user_id=23286

The reliance on registry keys (and ignoring other environment variables) can also cause other headaches.  Here's a problem I ran into on a stock Python 2.3 when trying to compile extensions using VC6:

I'm using STLport instead of the buggy STL implementation that ships with VC6.  To have the STL headers included I put the STL directory at the beginning of the INCLUDE search path in VCVARS32.BAT *and* by setting the appropriate values in the environment variables.  

With these settings, when I built my Python C++ extension by hand everything worked hunky-dory.  However when I tried to use distutils it kept including the old header files.  It took me a good 20 minutes of head scratching to realize that distutils was ignoring my environment variables and preferentially grabbing whatever INCLUDE directory was specified in the registry key (even if I ran VCVARS32.bat before compiling). Once I set the registry variable by hand, everything worked ok.

Perhaps distutils can be configured to look for environment settings *before* searching out whatever is buried in the registry?

--Paul M.
msg44377 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2006-04-15 09:04
Logged In: YES 
user_id=21627

As Python 2.3 is no longer maintained, and Python 2.4 (and
later) uses VS 2003, I'm rejecting the patch as out-of-date.
History
Date User Action Args
2022-04-10 16:10:24adminsetgithub: 38986
2003-07-31 12:50:07gtkcreate