summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 711ef37)
raw | patch | inline | side by side (parent: 711ef37)
author | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Wed, 17 Oct 2001 06:04:00 +0000 (06:04 +0000) | ||
committer | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Wed, 17 Oct 2001 06:04:00 +0000 (06:04 +0000) |
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@306 57a73879-2fb5-44c3-a270-3262357dd7e2
roundup-admin | patch | blob | history | |
setup.py | patch | blob | history |
diff --git a/roundup-admin b/roundup-admin
index d3b5d658a610df27e337a22205c6c7260e440387..befa0a28af5792b87863aaeb565a2c1d9a583e64 100755 (executable)
--- a/roundup-admin
+++ b/roundup-admin
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-# $Id: roundup-admin,v 1.29 2001-10-16 03:48:01 richard Exp $
+# $Id: roundup-admin,v 1.30 2001-10-17 06:04:00 richard Exp $
import sys
if int(sys.version[0]) < 2:
help = figureCommands().get(args[0], None)
if help:
print help.__doc__
+ else:
+ print 'Sorry, no help for "%s"'%args[0]
def help_initopts():
import roundup.templates
d[k[5:]] = v
return d
-def main():
- opts, args = getopt.getopt(sys.argv[1:], 'i:u:hc')
-
- # handle command-line args
- instance_home = os.environ.get('ROUNDUP_INSTANCE', '')
- name = password = ''
- if os.environ.has_key('ROUNDUP_LOGIN'):
- l = os.environ['ROUNDUP_LOGIN'].split(':')
- name = l[0]
- if len(l) > 1:
- password = l[1]
- comma_sep = 0
- for opt, arg in opts:
- if opt == '-h':
- args = ['help']
- break
- if opt == '-i':
- instance_home = arg
- if opt == '-c':
- comma_sep = 1
-
- # figure the command
- if not args:
- usage('No command specified')
- return 1
- command = args[0]
+class AdminTool:
+
+ def run_command(self, args):
+ command = args[0]
- # handle help now
- if command == 'help':
- if len(args)>1:
- do_help(args[1:])
+ # handle help now
+ if command == 'help':
+ if len(args)>1:
+ do_help(args[1:])
+ return 0
+ do_help(['help'])
+ return 0
+ if command == 'morehelp':
+ do_help(['help'])
+ help_commands()
+ help_all()
return 0
- usage()
- return 0
- if command == 'morehelp':
- usage()
- help_all()
- return 0
-
- # make sure we have an instance_home
- while not instance_home:
- instance_home = raw_input('Enter instance home: ').strip()
-
- # before we open the db, we may be doing an init
- if command == 'init':
- return do_init(instance_home, args)
-
- function = figureCommands().get(command, None)
-
- # not a valid command
- if function is None:
- usage('Unknown command "%s"'%command)
- return 1
- # get the instance
- instance = roundup.instance.open(instance_home)
- db = instance.open('admin')
+ # make sure we have an instance_home
+ while not self.instance_home:
+ self.instance_home = raw_input('Enter instance home: ').strip()
- if len(args) < 2:
- print function.__doc__
- return 1
+ # before we open the db, we may be doing an init
+ if command == 'init':
+ return do_init(self.instance_home, args)
- # do the command
- try:
- return function(db, args[1:], comma_sep=comma_sep)
- finally:
- db.close()
+ function = figureCommands().get(command, None)
- return 1
+ # not a valid command
+ if function is None:
+ usage('Unknown command "%s"'%command)
+ return 1
+
+ # get the instance
+ instance = roundup.instance.open(self.instance_home)
+ db = instance.open('admin')
+
+ if len(args) < 2:
+ print function.__doc__
+ return 1
+
+ # do the command
+ try:
+ return function(db, args[1:], comma_sep=self.comma_sep)
+ finally:
+ db.close()
+
+ return 1
+
+ def interactive(self, ws_re=re.compile(r'\s+')):
+ '''Run in an interactive mode
+ '''
+ while 1:
+ try:
+ command = raw_input('roundup> ')
+ except EOFError:
+ print '.. exit'
+ return 0
+ args = ws_re.split(command)
+ if not args: continue
+ if args[0] in ('quit', 'exit'): return 0
+ self.run_command(args)
+
+ def main(self):
+ opts, args = getopt.getopt(sys.argv[1:], 'i:u:hc')
+
+ # handle command-line args
+ self.instance_home = os.environ.get('ROUNDUP_INSTANCE', '')
+ name = password = ''
+ if os.environ.has_key('ROUNDUP_LOGIN'):
+ l = os.environ['ROUNDUP_LOGIN'].split(':')
+ name = l[0]
+ if len(l) > 1:
+ password = l[1]
+ self.comma_sep = 0
+ for opt, arg in opts:
+ if opt == '-h':
+ usage()
+ return 0
+ if opt == '-i':
+ self.instance_home = arg
+ if opt == '-c':
+ self.comma_sep = 1
+
+ # if no command - go interactive
+ if not args:
+ return self.interactive()
+
+ self.run_command(args)
if __name__ == '__main__':
- sys.exit(main())
+ tool = AdminTool()
+ sys.exit(tool.main())
#
# $Log: not supported by cvs2svn $
+# Revision 1.29 2001/10/16 03:48:01 richard
+# admin tool now complains if a "find" is attempted with a non-link property.
+#
# Revision 1.28 2001/10/13 00:07:39 richard
# More help in admin tool.
#
diff --git a/setup.py b/setup.py
index f4cf3efccf0af8ab43b26ac6bfa413f3a017247d..68f1074d7a013afe1dc952a52f9980b7bfcd161b 100644 (file)
--- a/setup.py
+++ b/setup.py
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-# $Id: setup.py,v 1.22 2001-10-11 05:01:28 richard Exp $
+# $Id: setup.py,v 1.23 2001-10-17 06:04:00 richard Exp $
from distutils.core import setup, Extension
from distutils.util import get_platform
setup ( name = "roundup",
- version = "0.3.0pre2",
+ version = "0.3.0pre3",
description = "Roundup issue tracking system.",
author = "Richard Jones",
author_email = "richard@users.sourceforge.net",
#
# $Log: not supported by cvs2svn $
+# Revision 1.22 2001/10/11 05:01:28 richard
+# Prep for pre-release #2
+#
# Revision 1.21 2001/10/10 04:18:38 richard
# Getting ready for a preview release for 0.3.0.
#