options.emit_linenums = True
elif option in ("-X", "--directive"):
try:
- options.compiler_directives = Options.parse_directive_list(pop_arg(), relaxed_bool=True)
+ options.compiler_directives = Options.parse_directive_list(
+ pop_arg(), relaxed_bool=True,
+ current_settings=options.compiler_directives)
except ValueError, e:
sys.stderr.write("Error in compiler directive: %s\n" % e.args[0])
sys.exit(1)
else:
assert False
-def parse_directive_list(s, relaxed_bool=False, ignore_unknown=False):
+def parse_directive_list(s, relaxed_bool=False, ignore_unknown=False,
+ current_settings=None):
"""
Parses a comma-separated list of pragma options. Whitespace
is not considered.
...
ValueError: Unknown option: "unknown"
"""
- result = {}
+ if current_settings is None:
+ result = {}
+ else:
+ result = current_settings
for item in s.split(','):
item = item.strip()
if not item: continue