ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/ccs/admin/users.py
Revision: 596
Committed: 2009-10-14T20:58:11-07:00 (15 years, 8 months ago) by douglas
Content type: text/x-python
File size: 552 byte(s)
Log Message:
Woo!

File Contents

# User Rev Content
1 douglas 596 #!/usr/bin/env python
2     # CCS Computer Science
3     #
4     # Douglas Thrift
5     #
6     # $Id$
7    
8     from __future__ import with_statement
9    
10     try:
11     from _users import users
12     except ImportError:
13     users = set()
14    
15     if __name__ == '__main__':
16     for file in ('/etc/passwd', '/etc/group'):
17     with open(file, 'rb') as file:
18     for line in file:
19     if line.startswith('#'):
20     continue
21    
22     users.update(line.split(':', 1)[:1])
23    
24     with open('_users.py', 'wb') as file:
25     file.write('users = set((\n')
26    
27     for user in sorted(users):
28     file.write('\t%s,\n' % repr(user))
29    
30     file.write('))\n')

Properties

Name Value
svn:executable *
svn:keywords Id