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
d4311b4e
Commit
d4311b4e
authored
Apr 25, 2015
by
Jeroen Demeyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Progress indicator for cythonize()
parent
f5716088
Changes
1
Hide 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 @
d4311b4e
...
@@ -832,7 +832,15 @@ def cythonize(module_list, exclude=[], nthreads=0, aliases=None, quiet=False, fo
...
@@ -832,7 +832,15 @@ def cythonize(module_list, exclude=[], nthreads=0, aliases=None, quiet=False, fo
if
not
os
.
path
.
exists
(
options
.
cache
):
if
not
os
.
path
.
exists
(
options
.
cache
):
os
.
makedirs
(
options
.
cache
)
os
.
makedirs
(
options
.
cache
)
to_compile
.
sort
()
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
=
"[{:%i}/{}] "
%
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
nthreads
=
0
if
nthreads
:
if
nthreads
:
# Requires multiprocessing (or Python >= 2.6)
# Requires multiprocessing (or Python >= 2.6)
...
@@ -862,7 +870,7 @@ def cythonize(module_list, exclude=[], nthreads=0, aliases=None, quiet=False, fo
...
@@ -862,7 +870,7 @@ def cythonize(module_list, exclude=[], nthreads=0, aliases=None, quiet=False, fo
pool
.
join
()
pool
.
join
()
if
not
nthreads
:
if
not
nthreads
:
for
args
in
to_compile
:
for
args
in
to_compile
:
cythonize_one
(
*
args
[
1
:]
)
cythonize_one
(
*
args
)
if
exclude_failures
:
if
exclude_failures
:
failed_modules
=
set
()
failed_modules
=
set
()
...
@@ -927,7 +935,7 @@ else:
...
@@ -927,7 +935,7 @@ else:
# TODO: Share context? Issue: pyx processing leaks into pxd module
# TODO: Share context? Issue: pyx processing leaks into pxd module
@
record_results
@
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.Main
import
compile
,
default_options
from
..Compiler.Errors
import
CompileError
,
PyrexError
from
..Compiler.Errors
import
CompileError
,
PyrexError
...
@@ -944,7 +952,7 @@ def cythonize_one(pyx_file, c_file, fingerprint, quiet, options=None, raise_on_f
...
@@ -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
))
options
.
cache
,
"%s-%s%s"
%
(
os
.
path
.
basename
(
c_file
),
fingerprint
,
gzip_ext
))
if
os
.
path
.
exists
(
fingerprint_file
):
if
os
.
path
.
exists
(
fingerprint_file
):
if
not
quiet
:
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
)
os
.
utime
(
fingerprint_file
,
None
)
g
=
gzip_open
(
fingerprint_file
,
'rb'
)
g
=
gzip_open
(
fingerprint_file
,
'rb'
)
try
:
try
:
...
@@ -957,7 +965,7 @@ def cythonize_one(pyx_file, c_file, fingerprint, quiet, options=None, raise_on_f
...
@@ -957,7 +965,7 @@ def cythonize_one(pyx_file, c_file, fingerprint, quiet, options=None, raise_on_f
g
.
close
()
g
.
close
()
return
return
if
not
quiet
:
if
not
quiet
:
print
(
"
Cythonizing %s"
%
pyx_file
)
print
(
"
%sCythonizing %s"
%
(
progress
,
pyx_file
)
)
if
options
is
None
:
if
options
is
None
:
options
=
CompilationOptions
(
default_options
)
options
=
CompilationOptions
(
default_options
)
options
.
output_file
=
c_file
options
.
output_file
=
c_file
...
@@ -1000,7 +1008,7 @@ def cythonize_one(pyx_file, c_file, fingerprint, quiet, options=None, raise_on_f
...
@@ -1000,7 +1008,7 @@ def cythonize_one(pyx_file, c_file, fingerprint, quiet, options=None, raise_on_f
def
cythonize_one_helper
(
m
):
def
cythonize_one_helper
(
m
):
import
traceback
import
traceback
try
:
try
:
return
cythonize_one
(
*
m
[
1
:]
)
return
cythonize_one
(
*
m
)
except
Exception
:
except
Exception
:
traceback
.
print_exc
()
traceback
.
print_exc
()
raise
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