[Distutils] Stylistic comments
Thu, 10 Feb 2000 11:20:13 +0000
In article <20000209215010.A611@beelzebub>, Greg Ward <email@example.com>
>Hi all (especially Robin and Thomas!) --
>I was just looking through the new registry-grovelling code in
>msvccompiler.py, making some stylistic changes, when I noticed the
>following in '_find_exe()' (comments added by me):
> for p in string.split(os.environ['Path'],';'):
> if os.path.isfile(fn):
> return fn
> # XXX BAD BAD BAD BAD BAD BAD BAD BAD BAD BAD BAD BAD !!!!!!!!!!!!!!!!
> except: # XXX WHAT'S BEING CAUGHT HERE?!?!?
>What is this 'except' clause supposed to catch?
well os.environ['Path'] may not be there and then it would be a keyError
>Other changes: I have renamed '_devstudio_versions()' to
>'get_devstudio_versions()' because it's more descriptive and I don't see
>a big need for the leading underscore; likewise '_msvc_get_paths()' is
>I've changed the 'get_devstudio_versions()' docstring to:
> """Get list of devstudio versions from the Windows registry. Return a
> list of strings (???) containing version numbers; the list will
> be empty if we were unable to access the registry (eg. couldn't
> import a registry-access module) or the appropriate registry
> keys weren't found. (XXX is this correct???)"""
Correct on the doc. I put underscore to stop these being implicitly
available outside of the module.
>I'd like a similarly explicit and useful docstring for
>'get_msvc_paths()', but don't understand it well enough to write one:
>could someone supply me one please?
>Oh yeah, I'm mystified by the purpose for '_find_SET()' and '_do_SET()'.
>Could I get docstrings for those please? Better parameter names (full
>words, not single characters!) might help.
'''' looks up in the registry and returns a list of values suitable for
use in a SET command eg SET name=value. Normally the value will be a
';' separated list similar to a path list.
name is the name of an MSVC path and version_number is a version_number
of an MSVC installation.
'''' sets os.environ[name] to an MSVC path type value obtained from
_find_SET. This is equivalent to a SET command prior to exceution of
>Also, the real reason I went off on this tangent was because we get an
>even *worse* traceback than before now on machines without MSVC++
>(eg. my Linux box being told to use an MSVCCompiler object, which used
>to work just fine in dry-run mode). In particular, it blows up because
>'get_devstudio_versions()' returns None, but '_find_exe()' expects a
>sequence. My inclination is to fix 'get_devstudio_versions()' to always
>return a list, empty if the imports failed. Ditto for
I thought we had that None fixed ages ago. They should return . What
to do if they do is open.
>'get_msvc_paths()' for consistency. Anyone see a problem with this?
>(I.e., are we ever going to need to distinguish "couldn't find anything
>in the registry" from "couldn't access the registry at all"?)