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
a0cbd421
Commit
a0cbd421
authored
Dec 11, 2010
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More inline tests, quiet tests.
parent
de46c66d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
18 deletions
+50
-18
Cython/Build/Dependencies.py
Cython/Build/Dependencies.py
+8
-7
Cython/Build/Inline.py
Cython/Build/Inline.py
+6
-7
Cython/Build/Tests/TestInline.py
Cython/Build/Tests/TestInline.py
+36
-3
runtests.py
runtests.py
+0
-1
No files found.
Cython/Build/Dependencies.py
View file @
a0cbd421
...
...
@@ -314,8 +314,8 @@ class DependencyTree(object):
self_pxd
=
[]
a
=
self
.
cimports
(
filename
)
b
=
filter
(
None
,
[
self
.
find_pxd
(
m
,
filename
)
for
m
in
self
.
cimports
(
filename
)])
if
len
(
a
)
!=
len
(
b
):
print
(
filename
)
if
len
(
a
)
-
int
(
'cython'
in
a
)
!=
len
(
b
):
print
(
"missing cimport"
,
filename
)
print
(
"
\
n
\
t
"
.
join
(
a
))
print
(
"
\
n
\
t
"
.
join
(
b
))
return
tuple
(
self_pxd
+
filter
(
None
,
[
self
.
find_pxd
(
m
,
filename
)
for
m
in
self
.
cimports
(
filename
)]))
...
...
@@ -442,7 +442,7 @@ def create_extension_list(patterns, exclude=[], ctx=None, aliases=None):
return
module_list
# This is the user-exposed entry point.
def
cythonize
(
module_list
,
exclude
=
[],
nthreads
=
0
,
aliases
=
None
,
**
options
):
def
cythonize
(
module_list
,
exclude
=
[],
nthreads
=
0
,
aliases
=
None
,
quiet
=
False
,
**
options
):
if
'include_path'
not
in
options
:
options
[
'include_path'
]
=
[
'.'
]
c_options
=
CompilationOptions
(
**
options
)
...
...
@@ -479,6 +479,7 @@ def cythonize(module_list, exclude=[], nthreads=0, aliases=None, **options):
dep_timestamp
,
dep
=
deps
.
newest_dependency
(
source
)
priority
=
2
-
(
dep
in
deps
.
immediate_dependencies
(
source
))
if
c_timestamp
<
dep_timestamp
:
if
not
quiet
:
if
source
==
dep
:
print
(
"Cythonizing %s because it changed."
%
source
)
else
:
...
...
Cython/Build/Inline.py
View file @
a0cbd421
#no doctest
print
"Warning: Using prototype cython.inline code..."
import
tempfile
import
sys
,
os
,
re
,
inspect
...
...
@@ -86,6 +83,7 @@ def cython_inline(code,
lib_dir
=
os
.
path
.
expanduser
(
'~/.cython/inline'
),
cython_include_dirs
=
[
'.'
],
force
=
False
,
quiet
=
False
,
locals
=
None
,
globals
=
None
,
**
kwds
):
...
...
@@ -107,10 +105,11 @@ def cython_inline(code,
elif
symbol
in
globals
:
kwds
[
symbol
]
=
globals
[
symbol
]
else
:
print
"Couldn't find "
,
symbol
print
(
"Couldn't find "
,
symbol
)
except
AssertionError
:
if
not
quiet
:
# Parsing from strings not fully supported (e.g. cimports).
print
"Could not parse code as a string (to extract unbound symbols)."
print
(
"Could not parse code as a string (to extract unbound symbols)."
)
arg_names
=
kwds
.
keys
()
arg_names
.
sort
()
arg_sigs
=
tuple
([(
get_type
(
kwds
[
arg
],
ctx
),
arg
)
for
arg
in
arg_names
])
...
...
@@ -158,7 +157,7 @@ def __invoke(%(params)s):
extra_compile_args = cflags)
build_extension = build_ext(Distribution())
build_extension.finalize_options()
build_extension.extensions = cythonize([extension], ctx=ctx)
build_extension.extensions = cythonize([extension], ctx=ctx
, quiet=quiet
)
build_extension.build_temp = os.path.dirname(pyx_file)
build_extension.build_lib = lib_dir
build_extension.run()
...
...
Cython/Build/Tests/TestInline.py
View file @
a0cbd421
from
Cython.Shadow
import
inline
from
Cython.Build.Inline
import
safe_type
from
Cython.TestUtils
import
CythonTest
try
:
import
numpy
has_numpy
=
True
except
:
has_numpy
=
False
test_kwds
=
dict
(
force
=
True
,
quiet
=
True
)
global_value
=
100
class
TestStripLiterals
(
CythonTest
):
def
test_inline
(
self
):
self
.
assertEquals
(
inline
(
"return 1+2"
),
3
)
def
test_simple
(
self
):
self
.
assertEquals
(
inline
(
"return 1+2"
,
**
test_kwds
),
3
)
def
test_types
(
self
):
self
.
assertEquals
(
inline
(
"""
cimport cython
return cython.typeof(a), cython.typeof(b)
"""
,
a
=
1.0
,
b
=
[],
**
test_kwds
),
(
'double'
,
'list object'
))
def
test_locals
(
self
):
a
=
1
b
=
2
self
.
assertEquals
(
inline
(
"return a+b"
,
**
test_kwds
),
3
)
def
test_globals
(
self
):
self
.
assertEquals
(
inline
(
"return global_value + 1"
,
**
test_kwds
),
global_value
+
1
)
if
has_numpy
:
def
test_numpy
(
self
):
import
numpy
a
=
numpy
.
ndarray
((
10
,
20
))
a
[
0
,
0
]
=
10
self
.
assertEquals
(
safe_type
(
a
),
'numpy.ndarray[numpy.float64_t, ndim=2]'
)
self
.
assertEquals
(
inline
(
"return a[0,0]"
,
a
=
a
,
**
test_kwds
),
10.0
)
runtests.py
View file @
a0cbd421
...
...
@@ -715,7 +715,6 @@ def collect_doctests(path, module_prefix, suite, selectors):
if
not
f
.
endswith
(
'.py'
):
continue
filepath
=
os
.
path
.
join
(
dirpath
,
f
)
if
os
.
path
.
getsize
(
filepath
)
==
0
:
continue
if
'no doctest'
in
open
(
filepath
).
next
():
continue
filepath
=
filepath
[:
-
len
(
".py"
)]
modulename
=
module_prefix
+
filepath
[
len
(
path
)
+
1
:].
replace
(
os
.
path
.
sep
,
'.'
)
if
not
[
1
for
match
in
selectors
if
match
(
modulename
)
]:
...
...
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