[ python-Feature Requests-1531505 ] distutils 'register' command and windows home directories

SourceForge.net noreply at sourceforge.net
Mon Jul 31 05:38:29 CEST 2006


Feature Requests item #1531505, was opened at 2006-07-30 20:38
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1531505&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.6
Status: Open
Resolution: None
Priority: 5
Submitted By: Josiah Carlson (josiahcarlson)
Assigned to: Nobody/Anonymous (nobody)
Summary: distutils 'register' command and windows home directories

Initial Comment:
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.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1531505&group_id=5470


More information about the Python-bugs-list mailing list