Skip to content

Commit

Permalink
setup.py: Added function to print fatal errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
Feuermurmel committed Sep 8, 2014
1 parent 8cc5572 commit 25682cd
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -1148,13 +1148,13 @@ def parse(self, argv = sys.argv):
optqueue.append(arg_opt)
argqueue.append(arg[arg.index('=') + 1:])
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)
elif (arg in self.optmap) and (self.optmap[arg][1] == ARGUMENTED):
optqueue.append(arg)
get = True
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)
else:
self.files.append(arg)
Expand All @@ -1168,9 +1168,12 @@ def parse(self, argv = sys.argv):
if (opt not in self.opts) or (self.opts[opt] is None):
self.opts[opt] = [arg]
else:
sys.stderr.write('%s: fatal: duplicate option %s\n' % (self.__program, arg))
self.print_fatal('duplicate option {}', arg)
exit(-1)

def print_fatal(self, message, *args):
sys.stderr.write('{}: fatal: {}\n'.format(self.__program, message.format(*args)))

def usage(self):
'''
Print a short usage message.
Expand Down

0 comments on commit 25682cd

Please sign in to comment.