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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
65dab373
Commit
65dab373
authored
Apr 21, 2016
by
Ian Henriksen
Committed by
Stefan Behnel
Jul 15, 2016
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
df1215d9
Changes
1
Show 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 @
65dab373
...
@@ -285,11 +285,10 @@ class Context(object):
...
@@ -285,11 +285,10 @@ class Context(object):
def
check_package_dir
(
self
,
dir
,
package_names
):
def
check_package_dir
(
self
,
dir
,
package_names
):
return
Utils
.
check_package_dir
(
dir
,
tuple
(
package_names
))
return
Utils
.
check_package_dir
(
dir
,
tuple
(
package_names
))
def
c_file_out_of_date
(
self
,
source_path
):
def
c_file_out_of_date
(
self
,
source_path
,
output_path
):
c_path
=
Utils
.
replace_suffix
(
source_path
,
".c"
)
if
not
os
.
path
.
exists
(
output_path
):
if
not
os
.
path
.
exists
(
c_path
):
return
1
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
):
if
Utils
.
file_newer_than
(
source_path
,
c_time
):
return
1
return
1
pos
=
[
source_path
]
pos
=
[
source_path
]
...
@@ -427,24 +426,28 @@ class Context(object):
...
@@ -427,24 +426,28 @@ class Context(object):
pass
pass
result
.
c_file
=
None
result
.
c_file
=
None
def
create_default_resultobj
(
compilation_source
,
options
):
def
get_output_filename
(
source_filename
,
cwd
,
options
):
result
=
CompilationResult
()
result
.
main_source_file
=
compilation_source
.
source_desc
.
filename
result
.
compilation_source
=
compilation_source
source_desc
=
compilation_source
.
source_desc
if
options
.
cplus
:
if
options
.
cplus
:
c_suffix
=
".cpp"
c_suffix
=
".cpp"
else
:
else
:
c_suffix
=
".c"
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
:
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
):
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
:
else
:
re
sult
.
c_file
=
out_path
re
turn
out_path
else
:
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
result
.
embedded_metadata
=
options
.
embedded_metadata
return
result
return
result
...
@@ -651,11 +654,14 @@ def compile_multiple(sources, options):
...
@@ -651,11 +654,14 @@ def compile_multiple(sources, options):
timestamps
=
options
.
timestamps
timestamps
=
options
.
timestamps
verbose
=
options
.
verbose
verbose
=
options
.
verbose
context
=
None
context
=
None
cwd
=
os
.
getcwd
()
for
source
in
sources
:
for
source
in
sources
:
if
source
not
in
processed
:
if
source
not
in
processed
:
if
context
is
None
:
if
context
is
None
:
context
=
options
.
create_context
()
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
:
if
verbose
:
sys
.
stderr
.
write
(
"Compiling %s
\
n
"
%
source
)
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