2
0
mirror of https://gitlab.com/ita1024/waf.git synced 2024-11-22 09:57:15 +01:00

Improve custom option processing #2280

This commit is contained in:
Thomas Nagy 2020-03-04 23:14:40 +01:00
parent 93a0258996
commit 4f8099fbdc

View File

@ -62,6 +62,21 @@ class opt_parser(optparse.OptionParser):
else:
self.error(str(e))
def _process_long_opt(self, rargs, values):
# --custom-option=-ftxyz is interpreted as -f -t... see #2280
if self.allow_unknown:
back = [] + rargs
try:
optparse.OptionParser._process_long_opt(self, rargs, values)
except optparse.BadOptionError:
while rargs:
rargs.pop()
rargs.extend(back)
rargs.pop(0)
raise
else:
optparse.OptionParser._process_long_opt(self, rargs, values)
def print_usage(self, file=None):
return self.print_help(file)