Mercurial > p > roundup > code
comparison roundup-admin @ 190:996eaf90c01e
Instance import now imports the instance using imp.load_module...
...so that we can have instance homes of "roundup" or other existing
python package names.
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Fri, 03 Aug 2001 00:59:34 +0000 |
| parents | a49c8a2ddd26 |
| children | 241a0323aacb |
comparison
equal
deleted
inserted
replaced
| 189:636ceccc7ed7 | 190:996eaf90c01e |
|---|---|
| 1 #! /usr/bin/python | 1 #! /usr/bin/python |
| 2 # $Id: roundup-admin,v 1.10 2001-07-30 08:12:17 richard Exp $ | 2 # $Id: roundup-admin,v 1.11 2001-08-03 00:59:34 richard Exp $ |
| 3 | 3 |
| 4 import sys | 4 import sys |
| 5 if int(sys.version[0]) < 2: | 5 if int(sys.version[0]) < 2: |
| 6 print 'Roundup requires python 2.0 or later.' | 6 print 'Roundup requires python 2.0 or later.' |
| 7 sys.exit(1) | 7 sys.exit(1) |
| 8 | 8 |
| 9 import string, os, getpass, getopt, re | 9 import string, os, getpass, getopt, re, imp |
| 10 from roundup import date, roundupdb, init | 10 from roundup import date, roundupdb, init |
| 11 | 11 |
| 12 def usage(message=''): | 12 def usage(message=''): |
| 13 if message: message = 'Problem: '+message+'\n' | 13 if message: message = 'Problem: '+message+'\n' |
| 14 commands = [] | 14 commands = [] |
| 379 name = raw_input('Login name: ') | 379 name = raw_input('Login name: ') |
| 380 while not password: | 380 while not password: |
| 381 password = getpass.getpass(' password: ') | 381 password = getpass.getpass(' password: ') |
| 382 | 382 |
| 383 # get the instance | 383 # get the instance |
| 384 path, instance = os.path.split(instance_home) | 384 instance = imp.load_module('instance', None, instance_home, ('', '', 5)) |
| 385 sys.path.insert(0, path) | |
| 386 try: | |
| 387 instance = __import__(instance) | |
| 388 finally: | |
| 389 del sys.path[0] | |
| 390 | 385 |
| 391 function = figureCommands().get(command, None) | 386 function = figureCommands().get(command, None) |
| 392 | 387 |
| 393 # not a valid command | 388 # not a valid command |
| 394 if function is None: | 389 if function is None: |
| 407 if __name__ == '__main__': | 402 if __name__ == '__main__': |
| 408 sys.exit(main()) | 403 sys.exit(main()) |
| 409 | 404 |
| 410 # | 405 # |
| 411 # $Log: not supported by cvs2svn $ | 406 # $Log: not supported by cvs2svn $ |
| 407 # Revision 1.10 2001/07/30 08:12:17 richard | |
| 408 # Added time logging and file uploading to the templates. | |
| 409 # | |
| 412 # Revision 1.9 2001/07/30 03:52:55 richard | 410 # Revision 1.9 2001/07/30 03:52:55 richard |
| 413 # init help now lists templates and backends | 411 # init help now lists templates and backends |
| 414 # | 412 # |
| 415 # Revision 1.8 2001/07/30 02:37:07 richard | 413 # Revision 1.8 2001/07/30 02:37:07 richard |
| 416 # Freshen is really broken. Commented out. | 414 # Freshen is really broken. Commented out. |
