mirror of
https://github.com/erkin/ponysay
synced 2024-11-27 13:50:52 +00:00
setup.py: Added function to print fatal errors.
This commit is contained in:
parent
8cc55723de
commit
25682cdfe9
1 changed files with 6 additions and 3 deletions
9
setup.py
9
setup.py
|
@ -1148,13 +1148,13 @@ class ArgParser():
|
||||||
optqueue.append(arg_opt)
|
optqueue.append(arg_opt)
|
||||||
argqueue.append(arg[arg.index('=') + 1:])
|
argqueue.append(arg[arg.index('=') + 1:])
|
||||||
else:
|
else:
|
||||||
sys.stderr.write('%s: fatal: unrecognised option %s. see --help or the manual\n' % (self.__program, arg))
|
self.print_fatal('Unrecognized option {}. Use the help command or consult the manual.', arg)
|
||||||
exit(-1)
|
exit(-1)
|
||||||
elif (arg in self.optmap) and (self.optmap[arg][1] == ARGUMENTED):
|
elif (arg in self.optmap) and (self.optmap[arg][1] == ARGUMENTED):
|
||||||
optqueue.append(arg)
|
optqueue.append(arg)
|
||||||
get = True
|
get = True
|
||||||
else:
|
else:
|
||||||
sys.stderr.write('%s: fatal: unrecognised option %s. see --help or the manual\n' % (self.__program, arg))
|
self.print_fatal('Unrecognized option {}. Use the help command or consult the manual.', arg)
|
||||||
exit(-1)
|
exit(-1)
|
||||||
else:
|
else:
|
||||||
self.files.append(arg)
|
self.files.append(arg)
|
||||||
|
@ -1168,9 +1168,12 @@ class ArgParser():
|
||||||
if (opt not in self.opts) or (self.opts[opt] is None):
|
if (opt not in self.opts) or (self.opts[opt] is None):
|
||||||
self.opts[opt] = [arg]
|
self.opts[opt] = [arg]
|
||||||
else:
|
else:
|
||||||
sys.stderr.write('%s: fatal: duplicate option %s\n' % (self.__program, arg))
|
self.print_fatal('duplicate option {}', arg)
|
||||||
exit(-1)
|
exit(-1)
|
||||||
|
|
||||||
|
def print_fatal(self, message, *args):
|
||||||
|
sys.stderr.write('{}: fatal: {}\n'.format(self.__program, message.format(*args)))
|
||||||
|
|
||||||
def usage(self):
|
def usage(self):
|
||||||
'''
|
'''
|
||||||
Print a short usage message.
|
Print a short usage message.
|
||||||
|
|
Loading…
Reference in a new issue