diff options
Diffstat (limited to 'Cython/Compiler')
-rw-r--r-- | Cython/Compiler/CmdLine.py | 5 | ||||
-rw-r--r-- | Cython/Compiler/Main.py | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/Cython/Compiler/CmdLine.py b/Cython/Compiler/CmdLine.py index 9e2f8beb0..470fe6bd4 100644 --- a/Cython/Compiler/CmdLine.py +++ b/Cython/Compiler/CmdLine.py @@ -53,6 +53,7 @@ Options: --module-name Fully qualified module name. If not given, it is deduced from the import path if source file is in a package, or equals the filename otherwise. + -M, --depfile Produce depfiles for the sources """ @@ -66,7 +67,6 @@ def bad_usage(): sys.stderr.write(usage) sys.exit(1) - def parse_command_line(args): from .Main import CompilationOptions, default_options @@ -195,6 +195,8 @@ def parse_command_line(args): sys.exit(1) elif option == "--module-name": options.module_name = pop_value() + elif option in ('-M', '--depfile'): + options.depfile = True elif option.startswith('--debug'): option = option[2:].replace('-', '_') from . import DebugFlags @@ -236,4 +238,3 @@ def parse_command_line(args): "cython: Only one source file allowed when using --module-name\n") sys.exit(1) return options, sources - diff --git a/Cython/Compiler/Main.py b/Cython/Compiler/Main.py index 128441da6..9c57452ba 100644 --- a/Cython/Compiler/Main.py +++ b/Cython/Compiler/Main.py @@ -514,6 +514,10 @@ def run_pipeline(source, options, full_module_name=None, context=None): context.setup_errors(options, result) err, enddata = Pipeline.run_pipeline(pipeline, source) context.teardown_errors(err, options, result) + if options.depfile: + from ..Build.Dependencies import create_dependency_tree + dependencies = create_dependency_tree(context).all_dependencies(result.main_source_file) + Utils.write_depfile(result.c_file, result.main_source_file, dependencies) return result @@ -881,6 +885,7 @@ default_options = dict( errors_to_stderr = 1, cplus = 0, output_file = None, + depfile = None, annotate = None, annotate_coverage_xml = None, generate_pxi = 0, |