diff options
Diffstat (limited to 'Cython/Compiler/Options.py')
-rw-r--r-- | Cython/Compiler/Options.py | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/Cython/Compiler/Options.py b/Cython/Compiler/Options.py index af28a7187..73778aaf9 100644 --- a/Cython/Compiler/Options.py +++ b/Cython/Compiler/Options.py @@ -171,7 +171,7 @@ def copy_inherited_directives(outer_directives, **new_directives): # For example, test_assert_path_exists and test_fail_if_path_exists should not be inherited # otherwise they can produce very misleading test failures new_directives_out = dict(outer_directives) - for name in ('test_assert_path_exists', 'test_fail_if_path_exists'): + for name in ('test_assert_path_exists', 'test_fail_if_path_exists', 'test_assert_c_code_has', 'test_fail_if_c_code_has'): new_directives_out.pop(name, None) new_directives_out.update(new_directives) return new_directives_out @@ -247,6 +247,8 @@ _directive_defaults = { # test support 'test_assert_path_exists' : [], 'test_fail_if_path_exists' : [], + 'test_assert_c_code_has' : [], + 'test_fail_if_c_code_has' : [], # experimental, subject to change 'formal_grammar': False, @@ -364,9 +366,10 @@ directive_scopes = { # defaults to available everywhere 'set_initial_path' : ('module',), 'test_assert_path_exists' : ('function', 'class', 'cclass'), 'test_fail_if_path_exists' : ('function', 'class', 'cclass'), + 'test_assert_c_code_has' : ('module',), + 'test_fail_if_c_code_has' : ('module',), 'freelist': ('cclass',), 'emit_code_comments': ('module',), - 'annotation_typing': ('module',), # FIXME: analysis currently lacks more specific function scope # Avoid scope-specific to/from_py_functions for c_string. 'c_string_type': ('module',), 'c_string_encoding': ('module',), @@ -388,7 +391,7 @@ directive_scopes = { # defaults to available everywhere # a list of directives that (when used as a decorator) are only applied to # the object they decorate and not to its children. immediate_decorator_directives = { - 'cfunc', 'ccall', 'cclass', + 'cfunc', 'ccall', 'cclass', 'dataclasses.dataclass', # function signature directives 'inline', 'exceptval', 'returns', # class directives @@ -510,6 +513,11 @@ def parse_directive_list(s, relaxed_bool=False, ignore_unknown=False, result[directive] = parsed_value if not found and not ignore_unknown: raise ValueError('Unknown option: "%s"' % name) + elif directive_types.get(name) is list: + if name in result: + result[name].append(value) + else: + result[name] = [value] else: parsed_value = parse_directive_value(name, value, relaxed_bool=relaxed_bool) result[name] = parsed_value @@ -662,6 +670,9 @@ class CompilationOptions(object): elif key in ['output_file', 'output_dir']: # ignore the exact name of the output file continue + elif key in ['depfile']: + # external build system dependency tracking file does not influence outputs + continue elif key in ['timestamps']: # the cache cares about the content of files, not about the timestamps of sources continue @@ -740,6 +751,7 @@ default_options = dict( errors_to_stderr=1, cplus=0, output_file=None, + depfile=None, annotate=None, annotate_coverage_xml=None, generate_pxi=0, @@ -758,6 +770,7 @@ default_options = dict( formal_grammar=False, gdb_debug=False, compile_time_env=None, + module_name=None, common_utility_include_dir=None, output_dir=None, build_dir=None, |