[py-dev] allow installation on windows with not-admin account
Harald Armin Massa
haraldarminmassa at gmail.com
Wed Jul 23 17:33:41 CEST 2008
Hello,
setup.py fails on windows with limited users because
k = _winreg.OpenKey(reg, key, 0, _winreg.KEY_WRITE)
is not allowed (raises windows error)
I suggest to patch with try, except within py\misc\_dist.py lines 94ff
as follows:
def addbindir2path():
if sys.platform != 'win32' or not winextensions:
return
# Add py/bin to PATH environment variable
bindir = os.path.join(sysconfig.get_python_lib(), "py", "bin", "win32")
reg = _winreg.ConnectRegistry(None, _winreg.HKEY_LOCAL_MACHINE)
key = r"SYSTEM\CurrentControlSet\Control\Session Manager\Environment"
path = get_registry_value(reg, key, "Path")
path += ";" + bindir
print "Setting PATH to:", path
try:
set_registry_value(reg, key, "Path", path)
except WindowsError:
print "could not write new path to registry. permissions?"
return
#print "Current PATH is:", get_registry_value(reg, key, "Path")
# Propagate changes throughout the system
win32gui.SendMessageTimeout(win32con.HWND_BROADCAST,
win32con.WM_SETTINGCHANGE, 0, "Environment",
win32con.SMTO_ABORTIFHUNG, 5000)
# Propagate changes to current command prompt
os.system("set PATH=%s" % path)
Harald
--
GHUM Harald Massa
persuadere et programmare
Harald Armin Massa
Spielberger Straße 49
70435 Stuttgart
0173/9409607
no fx, no carrier pigeon
-
EuroPython 2009 will take place in Birmingham - Stay tuned!
More information about the Pytest-dev
mailing list