home *** CD-ROM | disk | FTP | other *** search
- # Copyright 2001 (C) ActiveState Tool Corp., All Rights Reserved.
- # Written by Houman Ghaemi <houmang@activestate.com>
- #
- import PPM
- from PPM import PyPMHelps
- import os, sys, getopt
- from PPM.ppmerrors import errorreporter
- import traceback
-
- def run(args):
- try:
- args = filter(None, args)
-
- # first parse the option list
- pause = 0
- if len(args) >= 1:
- if args[0] == '-p' or args[0] == '--pause':
- pause = 1
- args = args[1:]
- # why is genconfig special?
- if len(args)>=1 and \
- args[0]=='genconfig':
- if os.name=='nt':
- OSVALUE='MSWin32'
- else:
- OSVALUE=os.name
- tempvar= os.path.join(sys.exec_prefix,'Downloads')
- try:
- print PyPMHelps.configstr % (os.name , os.environ['TEMP'] , '')
- except KeyError:
- print PyPMHelps.configstr % (os.name , tempvar , '')
-
- else:
- shell = PPM.Pyshell(args,pause)
- shell.cmdloop()
- except SystemExit, e:
- sys.exit(e.code)
- except KeyboardInterrupt:
- return
-
- except:
- type, value, tb = sys.exc_info()
-
- tb = "".join(traceback.format_tb(tb))
- msg = "Unhandled exception: %s \n %s \n %s" % (type, value, tb)
- errorreporter.Msg(msg)
- error = "Unhandled exception: %s \n %s" % (type, value)
- errorreporter.Fatal(msg)
-
- if __name__=='__main__':
- run(sys.argv[1:])
-