Utilities/Startup.py

changeset 12
1d8dd9706f46
parent 0
de9c2efb9d02
child 13
1af94a91f439
equal deleted inserted replaced
11:b0996e4a289e 12:1d8dd9706f46
59 ("--version", "show the program's version number and exit"), 59 ("--version", "show the program's version number and exit"),
60 ("-h, --help", "show this help message and exit") 60 ("-h, --help", "show this help message and exit")
61 ] 61 ]
62 options.extend(appinfo["options"]) 62 options.extend(appinfo["options"])
63 63
64 print \ 64 print("""
65 """
66 Usage: %(bin)s [OPTIONS] %(arg)s 65 Usage: %(bin)s [OPTIONS] %(arg)s
67 66
68 %(name)s - %(description)s 67 %(name)s - %(description)s
69 68
70 Options:""" % appinfo 69 Options:""" % appinfo)
71 for opt in options: 70 for opt in options:
72 print " %s %s" % (opt[0].ljust(optlen), opt[1]) 71 print(" %s %s" % (opt[0].ljust(optlen), opt[1]))
73 sys.exit(0) 72 sys.exit(0)
74 73
75 def version(appinfo): 74 def version(appinfo):
76 """ 75 """
77 Module function to show the version information. 76 Module function to show the version information.
78 77
79 @param appinfo dictionary describing the application 78 @param appinfo dictionary describing the application
80 """ 79 """
81 print \ 80 print("""
82 """
83 %(name)s %(version)s 81 %(name)s %(version)s
84 82
85 %(description)s 83 %(description)s
86 84
87 Copyright (c) 2002 - 2009 Detlev Offenbach <detlev@die-offenbachs.de> 85 Copyright (c) 2002 - 2009 Detlev Offenbach <detlev@die-offenbachs.de>
88 This is free software; see LICENSE.GPL3 for copying conditions. 86 This is free software; see LICENSE.GPL3 for copying conditions.
89 There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A 87 There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
90 PARTICULAR PURPOSE.""" % appinfo 88 PARTICULAR PURPOSE.""" % appinfo)
91 sys.exit(0) 89 sys.exit(0)
92 90
93 def handleArgs(argv, appinfo): 91 def handleArgs(argv, appinfo):
94 """ 92 """
95 Module function to handle the always present commandline options. 93 Module function to handle the always present commandline options.
125 for dir in dirs: 123 for dir in dirs:
126 loaded = trans.load(tn, dir) 124 loaded = trans.load(tn, dir)
127 if loaded: 125 if loaded:
128 return (trans, True) 126 return (trans, True)
129 127
130 print "Warning: translation file '" + tn + "'could not be loaded." 128 print("Warning: translation file '" + tn + "'could not be loaded.")
131 print "Using default." 129 print("Using default.")
132 return (None, False) 130 return (None, False)
133 131
134 def initializeResourceSearchPath(): 132 def initializeResourceSearchPath():
135 """ 133 """
136 Module function to initialize the default mime source factory. 134 Module function to initialize the default mime source factory.

eric ide

mercurial