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
422fd199
Commit
422fd199
authored
Nov 05, 2010
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Inline numpy support.
parent
9de33b2a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
Cython/Build/Inline.py
Cython/Build/Inline.py
+8
-5
No files found.
Cython/Build/Inline.py
View file @
422fd199
...
...
@@ -106,21 +106,24 @@ def cython_inline(code,
arg_names
=
kwds
.
keys
()
arg_names
.
sort
()
arg_sigs
=
tuple
([(
get_type
(
kwds
[
arg
],
ctx
),
arg
)
for
arg
in
arg_names
])
key
=
code
,
arg_sigs
module_name
=
_code_cache
.
get
(
key
)
if
module_name
is
None
:
module_name
=
"_cython_inline_"
+
hashlib
.
md5
(
code
+
str
(
arg_sigs
)
+
Cython
.
__version__
).
hexdigest
()
key
=
code
,
arg_sigs
,
sys
.
version_info
,
sys
.
executable
,
Cython
.
__version__
module_name
=
"_cython_inline_"
+
hashlib
.
md5
(
str
(
key
)).
hexdigest
()
try
:
if
lib_dir
not
in
sys
.
path
:
sys
.
path
.
append
(
lib_dir
)
__import__
(
module_name
)
except
ImportError
:
c_include_dirs
=
[]
cimports
=
[]
qualified
=
re
.
compile
(
r'([.\
w]+)[.]
')
for type, _ in arg_sigs:
m = qualified.match(type)
if m:
cimports.append('
\
ncimport
%
s
' % m.groups()[0])
# one special case
if m.groups()[0] == '
numpy
':
import numpy
c_include_dirs.append(numpy.get_include())
module_body, func_body = extract_func_code(code)
params = '
,
'.join(['
%
s
%
s
' % a for a in arg_sigs])
module_code = """
...
...
@@ -136,7 +139,7 @@ def __invoke(%(params)s):
extension = Extension(
name = module_name,
sources = [pyx_file],
pyrex_include_dirs =
include_dirs)
include_dirs = c_
include_dirs)
build_extension = build_ext(Distribution())
build_extension.finalize_options()
build_extension.extensions = cythonize([extension])
...
...
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