[Distutils] msvccompiler clobbers LIB/INCLUDE vars

Mark Hammond mhammond at skippinet.com.au
Thu Jan 22 03:09:02 EST 2004

> 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.

> 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.

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.  I'm now sidetracked on what to do regarding the lack of
install-script on 2.2 ;)



More information about the Distutils-SIG mailing list