[Distutils] More Windows questions

Chris Lambacher chris at kateandchris.net
Wed Oct 4 06:15:30 CEST 2006


On Tue, Oct 03, 2006 at 08:10:49PM -0400, Phillip J. Eby wrote:
> Okay, I've looked at the registry a bit, and it seems like I can register 
> App Paths either under HKLM (for the whole machine) or under HKCU (for the 
> current user).  However, both seem to have issues.
> 
> Under later versions of Windows, especially when not running with 
> administrative privileges, the HKLM keys will probably be off limits, and 
> might generate warning popups of various kinds.  On the other hand, HKCU 
> might not be that useful for a system-wide Python installation, and would 
> seem to force you to repeatedly reinstall for each user.
> 
> I could ask the user, but they're not really any more likely to know what 
> to do either, and in any case I'm thinking that for 0.6 I'd prefer to keep 
I have seen a number of installers that phrase it as a radio group like
"Install for:   [] all users    [] just me.".  You can probably detect whether
the user has admin rights and not ask if they don't have permission for the
initial install of setuptools.  Eggs installed with easy_install can know how
easy install was installed and follow that setting if the user doing the
install is the same or has equivalent rights.

I think there are 3 scenarios on Windows that are likely: 
1. The installing user is always a privileged user, and the only user of the
computer so either HKLM and HKCU will work
2. The installing user is unprivileged and therefore not expecting to install
for everyone, so HKCU will do the trick.
3. The installing user is the administrator who expects the installation to
work for all users and so needs HKLM to work.  Presumably this user knows
something about Windows (not necessarily so for the first two users) but is
far less likely to know anything about windows (i.e. is installing for user #2
and doesn't know anything about this Python crap, he just wants user #2 to
stop bugging him about installing program/library/package x). 

> the installation code as simple as possible.  (Which means I don't want to 
> even bother with a dialog, and will therefore just skip the .egg 
> registration idea.)
If you (can) detect permissions doing what you can with those permission will
probably "just work".  I don't know how you go about figuring out what
permissions the current user has.  You might need ctypes or win32all or a C
extension to figure out what permissions a user has.

On the download side, is there a way to force the download to go through the
windows APIs that perform the proxy authentication?  I think the Cygwin
installer does something like that.  I always used
http://ntlmaps.sourceforge.net/ which is written in python and licensed under
GPL.  Maybe that can be used, unless I misunderstand the download issue.

-Chris


More information about the Distutils-SIG mailing list