[Zope3-Users] Re: Getting current user and current user's group in a buildout script

Derek Richardson derek.richardson at gatech.edu
Mon Oct 1 17:20:17 EDT 2007


Martin Aspeli wrote:
> Derek Richardson wrote:
>> So, is there an easy way to do it? I know I can write a recipe, but a 
>> recipe seems heavyweight for this. It seems to me that access to these 
>> two values should be built into buildout as implicit variables. Is 
>> this contrary to the lightweight, pluggable design philosophy?
> 
> What's the use case here? I can't think of many good uses for something 
> that's going to vary depending on who's running the buildout.

The use case is that the pound (http://www.apsis.ch/pound) install is 
evil. Configure takes -o (owner) and -g (group) parameters to set 
ownership of the pound binary. This would be fine if leaving them blank 
defaulted to the current user and group. However, it defaults to 
system-specific settings, which, on my mac, is the 'www' user and 'www' 
group. Unless I run my buildout as root, the build fails. Not cool. 
Really, I'm only assuming that running as root would work, since I 
refuse to run buildout as root. So, to test on my mac, I want to pick up 
the current user and group.

I've written a recipe that, given no parameters, returns the name of the 
current user and current user's group. Given a user name, it returns the 
name of the specified user's group.

> Secondly, buildout and at least the recipes we like to promote are 
> cross-platform. This may not be as easy to achieve on Windows.

Yep. So, unfortunately, I may not release this recipe.

> Thirdly, users can be in multiple groups, so at least you'd need a list, 
> which may not lend itself so well to the standard way of using variables 
> in buildout.

The UNIX gid from the password database is good enough.



More information about the Zope3-users mailing list