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
Gwenaël Samain
cython
Commits
aac55cf6
Commit
aac55cf6
authored
May 22, 2015
by
scoder
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #382 from jdemeyer/progress
Progress indicator for cythonize()
parents
3b6c1dde
ea794542
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
6 deletions
+14
-6
Cython/Build/Dependencies.py
Cython/Build/Dependencies.py
+14
-6
No files found.
Cython/Build/Dependencies.py
View file @
aac55cf6
...
...
@@ -832,7 +832,15 @@ def cythonize(module_list, exclude=[], nthreads=0, aliases=None, quiet=False, fo
if
not
os
.
path
.
exists
(
options
.
cache
):
os
.
makedirs
(
options
.
cache
)
to_compile
.
sort
()
if
len
(
to_compile
)
<=
1
:
# Drop "priority" component of "to_compile" entries and add a
# simple progress indicator.
N
=
len
(
to_compile
)
progress_fmt
=
"[{0:%d}/{1}] "
%
len
(
str
(
N
))
for
i
in
range
(
N
):
progress
=
progress_fmt
.
format
(
i
+
1
,
N
)
to_compile
[
i
]
=
to_compile
[
i
][
1
:]
+
(
progress
,)
if
N
<=
1
:
nthreads
=
0
if
nthreads
:
# Requires multiprocessing (or Python >= 2.6)
...
...
@@ -862,7 +870,7 @@ def cythonize(module_list, exclude=[], nthreads=0, aliases=None, quiet=False, fo
pool
.
join
()
if
not
nthreads
:
for
args
in
to_compile
:
cythonize_one
(
*
args
[
1
:]
)
cythonize_one
(
*
args
)
if
exclude_failures
:
failed_modules
=
set
()
...
...
@@ -927,7 +935,7 @@ else:
# TODO: Share context? Issue: pyx processing leaks into pxd module
@
record_results
def
cythonize_one
(
pyx_file
,
c_file
,
fingerprint
,
quiet
,
options
=
None
,
raise_on_failure
=
True
,
embedded_metadata
=
None
):
def
cythonize_one
(
pyx_file
,
c_file
,
fingerprint
,
quiet
,
options
=
None
,
raise_on_failure
=
True
,
embedded_metadata
=
None
,
progress
=
""
):
from
..Compiler.Main
import
compile
,
default_options
from
..Compiler.Errors
import
CompileError
,
PyrexError
...
...
@@ -944,7 +952,7 @@ def cythonize_one(pyx_file, c_file, fingerprint, quiet, options=None, raise_on_f
options
.
cache
,
"%s-%s%s"
%
(
os
.
path
.
basename
(
c_file
),
fingerprint
,
gzip_ext
))
if
os
.
path
.
exists
(
fingerprint_file
):
if
not
quiet
:
print
(
"
Found compiled %s in cache"
%
pyx_file
)
print
(
"
%sFound compiled %s in cache"
%
(
progress
,
pyx_file
)
)
os
.
utime
(
fingerprint_file
,
None
)
g
=
gzip_open
(
fingerprint_file
,
'rb'
)
try
:
...
...
@@ -957,7 +965,7 @@ def cythonize_one(pyx_file, c_file, fingerprint, quiet, options=None, raise_on_f
g
.
close
()
return
if
not
quiet
:
print
(
"
Cythonizing %s"
%
pyx_file
)
print
(
"
%sCythonizing %s"
%
(
progress
,
pyx_file
)
)
if
options
is
None
:
options
=
CompilationOptions
(
default_options
)
options
.
output_file
=
c_file
...
...
@@ -1000,7 +1008,7 @@ def cythonize_one(pyx_file, c_file, fingerprint, quiet, options=None, raise_on_f
def
cythonize_one_helper
(
m
):
import
traceback
try
:
return
cythonize_one
(
*
m
[
1
:]
)
return
cythonize_one
(
*
m
)
except
Exception
:
traceback
.
print_exc
()
raise
...
...
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