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
Boxiang Sun
cython
Commits
e148af69
Commit
e148af69
authored
Sep 10, 2017
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Compile Pythran module on installation since it is called a lot now.
parent
0e6322e4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
0 deletions
+9
-0
Cython/Compiler/Pythran.py
Cython/Compiler/Pythran.py
+8
-0
setup.py
setup.py
+1
-0
No files found.
Cython/Compiler/Pythran.py
View file @
e148af69
...
@@ -2,6 +2,8 @@ from __future__ import absolute_import
...
@@ -2,6 +2,8 @@ from __future__ import absolute_import
from
.PyrexTypes
import
CType
,
CTypedefType
,
CStructOrUnionType
from
.PyrexTypes
import
CType
,
CTypedefType
,
CStructOrUnionType
import
cython
# Pythran/Numpy specific operations
# Pythran/Numpy specific operations
...
@@ -13,6 +15,7 @@ def has_np_pythran(env):
...
@@ -13,6 +15,7 @@ def has_np_pythran(env):
env
=
env
.
outer_scope
env
=
env
.
outer_scope
@
cython
.
ccall
def
is_pythran_supported_dtype
(
type_
):
def
is_pythran_supported_dtype
(
type_
):
if
isinstance
(
type_
,
CTypedefType
):
if
isinstance
(
type_
,
CTypedefType
):
return
is_pythran_supported_type
(
type_
.
typedef_base_type
)
return
is_pythran_supported_type
(
type_
.
typedef_base_type
)
...
@@ -40,6 +43,7 @@ def pythran_type(Ty, ptype="ndarray"):
...
@@ -40,6 +43,7 @@ def pythran_type(Ty, ptype="ndarray"):
raise
ValueError
(
"unsupported pythran type %s (%s)"
%
(
Ty
,
type
(
Ty
)))
raise
ValueError
(
"unsupported pythran type %s (%s)"
%
(
Ty
,
type
(
Ty
)))
@
cython
.
ccall
def
type_remove_ref
(
ty
):
def
type_remove_ref
(
ty
):
return
"typename std::remove_reference<%s>::type"
%
ty
return
"typename std::remove_reference<%s>::type"
%
ty
...
@@ -100,6 +104,7 @@ def pythran_func_type(func, args):
...
@@ -100,6 +104,7 @@ def pythran_func_type(func, args):
return
"decltype(pythonic::numpy::functor::%s{}(%s))"
%
(
func
,
args
)
return
"decltype(pythonic::numpy::functor::%s{}(%s))"
%
(
func
,
args
)
@
cython
.
ccall
def
to_pythran
(
op
,
ptype
=
None
):
def
to_pythran
(
op
,
ptype
=
None
):
op_type
=
op
.
type
op_type
=
op
.
type
if
op_type
.
is_int
:
if
op_type
.
is_int
:
...
@@ -116,6 +121,7 @@ def to_pythran(op, ptype=None):
...
@@ -116,6 +121,7 @@ def to_pythran(op, ptype=None):
return
"from_python<%s>(%s)"
%
(
ptype
,
op
.
py_result
())
return
"from_python<%s>(%s)"
%
(
ptype
,
op
.
py_result
())
@
cython
.
ccall
def
is_type
(
type_
,
types
):
def
is_type
(
type_
,
types
):
for
attr
in
types
:
for
attr
in
types
:
if
getattr
(
type_
,
attr
,
False
):
if
getattr
(
type_
,
attr
,
False
):
...
@@ -127,6 +133,7 @@ def is_pythran_supported_node_or_none(node):
...
@@ -127,6 +133,7 @@ def is_pythran_supported_node_or_none(node):
return
node
.
is_none
or
is_pythran_supported_type
(
node
.
type
)
return
node
.
is_none
or
is_pythran_supported_type
(
node
.
type
)
@
cython
.
ccall
def
is_pythran_supported_type
(
type_
):
def
is_pythran_supported_type
(
type_
):
pythran_supported
=
(
pythran_supported
=
(
"is_pythran_expr"
,
"is_int"
,
"is_numeric"
,
"is_float"
,
"is_none"
,
"is_complex"
)
"is_pythran_expr"
,
"is_int"
,
"is_numeric"
,
"is_float"
,
"is_none"
,
"is_complex"
)
...
@@ -139,6 +146,7 @@ def is_pythran_supported_operation_type(type_):
...
@@ -139,6 +146,7 @@ def is_pythran_supported_operation_type(type_):
return
is_type
(
type_
,
pythran_supported
)
or
is_pythran_expr
(
type_
)
return
is_type
(
type_
,
pythran_supported
)
or
is_pythran_expr
(
type_
)
@
cython
.
ccall
def
is_pythran_expr
(
type_
):
def
is_pythran_expr
(
type_
):
return
type_
.
is_pythran_expr
return
type_
.
is_pythran_expr
...
...
setup.py
View file @
e148af69
...
@@ -88,6 +88,7 @@ def compile_cython_modules(profile=False, compile_more=False, cython_with_refnan
...
@@ -88,6 +88,7 @@ def compile_cython_modules(profile=False, compile_more=False, cython_with_refnan
compiled_modules
=
[
compiled_modules
=
[
"Cython.Plex.Scanners"
,
"Cython.Plex.Scanners"
,
"Cython.Plex.Actions"
,
"Cython.Plex.Actions"
,
"Cython.Compiler.Pythran"
,
"Cython.Compiler.Lexicon"
,
"Cython.Compiler.Lexicon"
,
"Cython.Compiler.Scanning"
,
"Cython.Compiler.Scanning"
,
"Cython.Compiler.Parsing"
,
"Cython.Compiler.Parsing"
,
...
...
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