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
5bf168ac
Commit
5bf168ac
authored
May 05, 2019
by
serge-sans-paille
Committed by
Stefan Behnel
Jun 11, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make pythran version checks more resilient
Current checks breaks when setting 0.10.0 as a Pythran version :-/
parent
34de6ba8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
28 deletions
+24
-28
Cython/Build/Dependencies.py
Cython/Build/Dependencies.py
+10
-11
Cython/Compiler/Pythran.py
Cython/Compiler/Pythran.py
+10
-11
runtests.py
runtests.py
+4
-6
No files found.
Cython/Build/Dependencies.py
View file @
5bf168ac
...
...
@@ -34,10 +34,8 @@ except ImportError:
try
:
import
pythran
import
pythran.config
pythran_version
=
pythran
.
__version__
except
:
pythran
_version
=
None
pythran
=
None
from
..
import
Utils
from
..Utils
import
(
cached_function
,
cached_method
,
path_exists
,
...
...
@@ -125,13 +123,13 @@ def file_hash(filename):
def
update_pythran_extension
(
ext
):
if
not
pythran_version
:
if
pythran
is
None
:
raise
RuntimeError
(
"You first need to install Pythran to use the np_pythran directive."
)
pythran_ext
=
(
pythran
.
config
.
make_extension
(
python
=
True
)
if
pythran_version
>=
'0.9'
or
pythran_version
>=
'0.8.7'
else
pythran
.
config
.
make_extension
()
)
try
:
pythran
_ext
=
pythran
.
config
.
make_extension
(
python
=
True
)
except
TypeError
:
# older pythran version only
pythran_ext
=
pythran
.
config
.
make_extension
()
ext
.
include_dirs
.
extend
(
pythran_ext
[
'include_dirs'
])
ext
.
extra_compile_args
.
extend
(
pythran_ext
[
'extra_compile_args'
])
ext
.
extra_link_args
.
extend
(
pythran_ext
[
'extra_link_args'
])
...
...
@@ -947,8 +945,9 @@ def cythonize(module_list, exclude=None, nthreads=0, aliases=None, quiet=False,
if
'common_utility_include_dir'
in
options
:
safe_makedirs
(
options
[
'common_utility_include_dir'
])
pythran_options
=
None
if
pythran_version
:
if
pythran
is
None
:
pythran_options
=
None
else
:
pythran_options
=
CompilationOptions
(
**
options
)
pythran_options
.
cplus
=
True
pythran_options
.
np_pythran
=
True
...
...
Cython/Compiler/Pythran.py
View file @
5bf168ac
...
...
@@ -8,11 +8,10 @@ import cython
try
:
import
pythran
pythran_version
=
pythran
.
__version__
pythran_is_0_8_7
=
pythran_version
>=
'0.9'
or
pythran_version
>=
'0.8.7'
pythran_is_pre_0_9
=
tuple
(
map
(
int
,
pythran
.
__version__
.
split
(
'.'
)[
0
:
2
]))
<
(
0
,
9
)
except
ImportError
:
pythran
_version
=
None
pythran_is_
0_8_7
=
Fals
e
pythran
=
None
pythran_is_
pre_0_9
=
Tru
e
# Pythran/Numpy specific operations
...
...
@@ -41,10 +40,10 @@ def pythran_type(Ty, ptype="ndarray"):
ctype
=
dtype
.
typedef_cname
else
:
raise
ValueError
(
"unsupported type %s!"
%
dtype
)
if
pythran_is_0_8_7
:
return
"pythonic::types::%s<%s,pythonic::types::pshape<%s>>"
%
(
ptype
,
ctype
,
","
.
join
((
"Py_ssize_t"
,)
*
ndim
))
else
:
if
pythran_is_pre_0_9
:
return
"pythonic::types::%s<%s,%d>"
%
(
ptype
,
ctype
,
ndim
)
else
:
return
"pythonic::types::%s<%s,pythonic::types::pshape<%s>>"
%
(
ptype
,
ctype
,
","
.
join
((
"Py_ssize_t"
,)
*
ndim
))
if
Ty
.
is_pythran_expr
:
return
Ty
.
pythran_type
#if Ty.is_none:
...
...
@@ -129,7 +128,10 @@ def np_func_to_list(func):
return
[]
return
np_func_to_list
(
func
.
obj
)
+
[
func
.
attribute
]
if
pythran_version
:
if
pythran
is
None
:
def
pythran_is_numpy_func_supported
(
name
):
return
False
else
:
def
pythran_is_numpy_func_supported
(
func
):
CurF
=
pythran
.
tables
.
MODULES
[
'numpy'
]
FL
=
np_func_to_list
(
func
)
...
...
@@ -138,9 +140,6 @@ if pythran_version:
if
CurF
is
None
:
return
False
return
True
else
:
def
pythran_is_numpy_func_supported
(
name
):
return
False
def
pythran_functor
(
func
):
func
=
np_func_to_list
(
func
)
...
...
runtests.py
View file @
5bf168ac
...
...
@@ -758,12 +758,10 @@ class TestBuilder(object):
pythran_dir = self.pythran_dir
if 'pythran' in tags['tag'] and not pythran_dir and 'cpp' in languages:
import pythran.config
from pythran import __version__ as pythran_version
pythran_ext = (
pythran.config.make_extension(python=True)
if pythran_version >= '0.9' or pythran_version >= '0.8.7'
else pythran.config.make_extension()
)
try:
pythran_ext = pythran.config.make_extension(python=True)
except TypeError: # old pythran version syntax
pythran_ext = pythran.config.make_extension()
pythran_dir = pythran_ext['include_dirs'][0]
preparse_list = tags.get('preparse', ['id'])
...
...
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