[Distutils] WinNT and distutils

Thomas Heller thomas.heller@ion-tof.com
Wed, 2 Feb 2000 18:18:51 +0100

there are some small typos in your patch,
and a more severe problem.

> + def _devstudio_versions():
> +     "Get a list of devstudio versions"
> +     try:
> +         import win32api
> +         import win32con
> +     except ImportError:
> +         return None
This should be
        except ImportError:
            return ()

> + def _msvc_get_paths(path, vNum='6.0', platform='x86'):
> +     "Get a devstudio path (include, lib or path)"
> +     try:
> +         import win32api
> +         import win32con
> +     except ImportError:
> +         return None
Same as above:
        except ImportError:
            return ()

> + def _find_exe(exe):
> +     for v in _devstudio_versions():
> +         for p in _msvc_get_paths('bin',v):
Should be:
            for p in _msvc_get_paths('path',v):

The more severe problem is the following:

The background is that in my PC I have registry entries for
version 5.0 and 6.0, although VC5.0 is no longer installed.
Note that I had 5.0 installed in different directories than 6.0!
It seems the setup program did not remove the 5.0 entries.
Now, what happens in your code is the following:
> !         self.cc   = _find_exe("cl.exe")
> !         self.link = _find_exe("link.exe")
find the 6.0 executables (because the 5.0 exes are no longer there).

> !         _do_SET('lib')
> !         _do_SET('include')
> !         path=_find_SET('path')
set the 5.0 environment (because _devstudio_versions() returns ['5.0',

Now the self.spawn() call launches cl.exe, this displays a Box that
some dll is not found, because this is not in the (invalid) path.

- Your code may mix up different versions of compiler, linker
and path, lib, and include directories. The code should first
determine a version which is actually installed, and then
set up everything, sticking to this version.

- _devstudio_versions() returns version numbers in ascending order,
so lower version numbers are preferred over higher version numbers.
Should be the other way (although I'm not sure if it is possible
to have different versions of VC installed at the same time).

Do you want to fix this, or should I prepare another patch?


Thomas Heller