Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cython
Commits
ed0f9787
Commit
ed0f9787
authored
Apr 21, 2016
by
Ian Henriksen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix timestamps option to work when generating a C++ output file and when
writing output file to a specified location.
parent
ef57fb78
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
15 deletions
+21
-15
Cython/Compiler/Main.py
Cython/Compiler/Main.py
+21
-15
No files found.
Cython/Compiler/Main.py
View file @
ed0f9787
...
...
@@ -285,11 +285,10 @@ class Context(object):
def
check_package_dir
(
self
,
dir
,
package_names
):
return
Utils
.
check_package_dir
(
dir
,
tuple
(
package_names
))
def
c_file_out_of_date
(
self
,
source_path
):
c_path
=
Utils
.
replace_suffix
(
source_path
,
".c"
)
if
not
os
.
path
.
exists
(
c_path
):
def
c_file_out_of_date
(
self
,
source_path
,
output_path
):
if
not
os
.
path
.
exists
(
output_path
):
return
1
c_time
=
Utils
.
modification_time
(
c
_path
)
c_time
=
Utils
.
modification_time
(
output
_path
)
if
Utils
.
file_newer_than
(
source_path
,
c_time
):
return
1
pos
=
[
source_path
]
...
...
@@ -427,24 +426,28 @@ class Context(object):
pass
result
.
c_file
=
None
def
create_default_resultobj
(
compilation_source
,
options
):
result
=
CompilationResult
()
result
.
main_source_file
=
compilation_source
.
source_desc
.
filename
result
.
compilation_source
=
compilation_source
source_desc
=
compilation_source
.
source_desc
def
get_output_filename
(
source_filename
,
cwd
,
options
):
if
options
.
cplus
:
c_suffix
=
".cpp"
else
:
c_suffix
=
".c"
suggested_file_name
=
Utils
.
replace_suffix
(
source_
desc
.
filename
,
c_suffix
)
suggested_file_name
=
Utils
.
replace_suffix
(
source_filename
,
c_suffix
)
if
options
.
output_file
:
out_path
=
os
.
path
.
join
(
c
ompilation_source
.
c
wd
,
options
.
output_file
)
out_path
=
os
.
path
.
join
(
cwd
,
options
.
output_file
)
if
os
.
path
.
isdir
(
out_path
):
re
sult
.
c_file
=
os
.
path
.
join
(
out_path
,
os
.
path
.
basename
(
suggested_file_name
))
re
turn
os
.
path
.
join
(
out_path
,
os
.
path
.
basename
(
suggested_file_name
))
else
:
re
sult
.
c_file
=
out_path
re
turn
out_path
else
:
result
.
c_file
=
suggested_file_name
return
suggested_file_name
def
create_default_resultobj
(
compilation_source
,
options
):
result
=
CompilationResult
()
result
.
main_source_file
=
compilation_source
.
source_desc
.
filename
result
.
compilation_source
=
compilation_source
source_desc
=
compilation_source
.
source_desc
result
.
c_file
=
get_output_filename
(
source_desc
.
filename
,
compilation_source
.
cwd
,
options
)
result
.
embedded_metadata
=
options
.
embedded_metadata
return
result
...
...
@@ -651,11 +654,14 @@ def compile_multiple(sources, options):
timestamps
=
options
.
timestamps
verbose
=
options
.
verbose
context
=
None
cwd
=
os
.
getcwd
()
for
source
in
sources
:
if
source
not
in
processed
:
if
context
is
None
:
context
=
options
.
create_context
()
if
not
timestamps
or
context
.
c_file_out_of_date
(
source
):
output_filename
=
get_output_filename
(
source
,
cwd
,
options
)
out_of_date
=
context
.
c_file_out_of_date
(
source
,
output_filename
)
if
(
not
timestamps
)
or
out_of_date
:
if
verbose
:
sys
.
stderr
.
write
(
"Compiling %s
\
n
"
%
source
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment