
In article <02de01bf6da1$93dba1b0$4500a8c0@thomasnotebook>, Thomas Heller <thomas.heller@ion-tof.com> writes Agreed about the typos. I had some idea of checking for non-availability using None. It's simpler to return []. As for the other at the bottom of _devstudio_versions try L.reverse() after the L.sort(). I meant to do that originally, but failed. Then the versions should return the versions in latest first order. It's a bit of a pain to have multiple versions. Probably we should get a version just once and pass to the other lookups as required. if multiple versions are available there's always a choice to be made. Probably we should write a warning message into the output and use the latest throughout. Is there an obvious version flag setup.py?
Robin, 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', '6.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.
Conclusion: - 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?
Regards,
Thomas Heller
_______________________________________________ Distutils-SIG maillist - Distutils-SIG@python.org http://www.python.org/mailman/listinfo/distutils-sig
-- Robin Becker