The current version of the Distutils 'register' command
does not support Windows 2k or XP home directories, as
it checks for 'HOME' in os.environ . This is suffient
for posix platforms, but for Windows 2k and XP,
generally 'home directories' are specified via the
environment variable 'USERPROFILE', or can be
constructed from 'HOMEDRIVE' and 'HOMEPATH'.
A simple fix would be to create two functions:
has_home() and get_home(), whose purposes are to
determine whether a home directory exists for the
current platform, and to get the home directory for the
current platform, respectively.
A sample implementation of both functions is as follows
(replace the leading commas with spaces).
keys = ['HOME', 'USERPROFILE']
def has_home():
,,,,for i in keys:
,,,,,,,,if i in os.environ:
,,,,,,,,,,,,return 1
,,,,return 0
def get_home():
,,,,for i in keys:
,,,,,,,,if i in os.environ:
,,,,,,,,,,,,return os.environ[i]
Once those definitions are made, then the two relevant
portions of
distutils.command.register.register.set_metadata() can
be updated to use these two functions. |