Paul Moore wrote:
I'm trying to build an extension (Imaging) which depends on a number of external libraries (JPEG, Zlib, Tk). Rather than hard code the locations of the libraries in the setup.py, I set my INCLUDE and LIB environment variables so that MSVC picks up the libraries automatically. Unfortunately, this doesn't seem to work properly, as distutils ignores these variables! Checking in the source, I see that this is deliberate (see get_msvc_paths and set_path_env_var in msvccompiler.py).
I don't see any mention of the reasoning behind not looking at the OS env vars in sources.
I don't believe that this decision is correct - it leaves the user no way, short of modifying the registry manually, to add include/library directories to the standard paths. So manually hacking setup.py becomes a necessity.
Can I suggest that msvccompiler.py *adds* the current entries to INCLUDE and LIB, rather than replacing those variables completely. Or at least, that another way of including include/library directories external to setup.py be available...
I don't know about the convention for looking up parameters on Windows: do env vars override settings in the registry or the other way around ?
Depending on what the standard procedure is on Windows, I'd suggest to either prepend or append the env var settings to the LIB/INCLUDE values found through the registry.