Commit 899f01f3 authored by Robert Bradshaw's avatar Robert Bradshaw

Merge pull request #448 from bjodah/cython-output-file-dir

Allow output file to be a dir. E.g. 'cython -o . /path/somefile.pyx'
parents e414aa44 b2e61692
......@@ -432,14 +432,19 @@ def create_default_resultobj(compilation_source, options):
result.main_source_file = compilation_source.source_desc.filename
result.compilation_source = compilation_source
source_desc = compilation_source.source_desc
if options.output_file:
result.c_file = os.path.join(compilation_source.cwd, options.output_file)
else:
if options.cplus:
c_suffix = ".cpp"
else:
c_suffix = ".c"
result.c_file = Utils.replace_suffix(source_desc.filename, c_suffix)
suggested_file_name = Utils.replace_suffix(source_desc.filename, c_suffix)
if options.output_file:
out_path = os.path.join(compilation_source.cwd, options.output_file)
if os.path.isdir(out_path):
result.c_file = os.path.join(out_path, os.path.basename(suggested_file_name))
else:
result.c_file = out_path
else:
result.c_file = suggested_file_name
result.embedded_metadata = options.embedded_metadata
return result
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment