classification
Title: distutils 'register' command and windows home directories
Type: feature request
Components: Library (Lib) Versions: Python 2.6
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: josiahcarlson, tarek
Priority: normal Keywords:

Created on 2006-07-31 03:38 by josiahcarlson, last changed 2008-02-23 13:51 by tarek.

Messages
msg61249 (view) Author: Josiah Carlson (josiahcarlson) Date: 2006-07-31 03:38
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.
msg62728 (view) Author: Tarek Ziadé (tarek) Date: 2008-02-23 13:51
The patch of #1858 fixes this issue as well
History
Date User Action Args
2008-02-23 13:51:27tareksetnosy: + tarek
messages: + msg62728
2006-07-31 03:38:28josiahcarlsoncreate