Make multiple '--directive's on command line cumulative
authorCraig Citro <craigcitro@gmail.com>
Mon, 15 Mar 2010 04:40:49 +0000 (21:40 -0700)
committerCraig Citro <craigcitro@gmail.com>
Mon, 15 Mar 2010 04:40:49 +0000 (21:40 -0700)
Cython/Compiler/CmdLine.py
Cython/Compiler/Options.py

index 66cdc6482194f655dc7c259f487ac967caea9b08..11feaa873656db20342b6836cd2f2ef90b2c6a18 100644 (file)
@@ -116,7 +116,9 @@ def parse_command_line(args):
                 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)
index 270e19ff664f4923aea2cf07cf279b8ed8c5393c..5f32abddff63dd20b9480a8f781cb1c31f0a65e7 100644 (file)
@@ -129,7 +129,8 @@ def parse_directive_value(name, value, relaxed_bool=False):
     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.
@@ -152,7 +153,10 @@ def parse_directive_list(s, relaxed_bool=False, ignore_unknown=False):
        ...
     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