[Distutils] msvccompiler clobbers LIB/INCLUDE vars
Thomas Heller
theller at python.net
Thu Jan 22 03:24:16 EST 2004
"Mark Hammond" <mhammond at skippinet.com.au> writes:
>> It was decided in the early distutils development to prefer the
>> registry entries over env variables. Heck, most of my C/C++
>> developer collegues *never* run *anything* from the command line, or
>> even know about the msvcvars.bat, vcvars32.bat, and vsvars32.bat
>> batch files.
>
> Yes, I understand, hence my question about the intent.
>
>> Given the amount of complaints we get here about this, maybe the
>> decision was wrong.
>
> Do you get alot about this exact same thing? If so, I see no reason not to
> honour *both* LIB and the registry. Users who never run these batchfiles or
> use the commandline should have a fairly benign LIB/INCLUDE.
Most complaints that I remember were from users having 'broken' MSVC
installs - they installed MSVC, but never run the GUI, which is required
to complete the registry entries.
>> Can't you use the include_dirs and library_dirs arguments to the setup
>> function?
>
> The problem is that these paths are local to my machine. Eg, you ask the
> user to install some random MS SDK, so it is this user that needs to specify
> the new path. I'm not sure of the best way to hook that up.
Well, distutils probably behaves the same as MS IDE - when you install
the platforma sdk, you have to register it with visual studio: there's a
start menu entry for this ;-).
> I did find it very confusing though - I knew that it was the compiler itself
> that used the LIB/INCLUDE vars, and was very surprised to find the compiler
> didn't see what I explicitly set in the environment.
>
> Is there a reason you can't do something like:
> os.environ["lib"] = get_registry_libs() + os.environ["lib"]
> instead of what you do currently:
> os.environ["lib"] = get_registry_libs()
>
> ? Putting what you read from the registry first should ensure the same
> semantics. I don't really care, as I will have to work something out for
> 2.2/2.3 too.
That may be, but IMO it's too late to change distutils. And usually
there's a workaround by subclassing a distutils command or whatever.
> I'm now sidetracked on what to do regarding the lack of
> install-script on 2.2 ;)
You should be able to use 2.3's distutils on 2.2 to build your
installation without problems. It is only needed on build time.
Thomas
More information about the Distutils-SIG
mailing list