Commit 5c13e254 authored by Thomas Vincent's avatar Thomas Vincent

update setup.py from silx to support numpy 1.16

parent 798aba8d
......@@ -2,7 +2,7 @@
# coding: utf8
# /*##########################################################################
#
# Copyright (c) 2015-2018 European Synchrotron Radiation Facility
# Copyright (c) 2015-2019 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
......@@ -106,6 +106,7 @@ classifiers = ["Development Status :: 4 - Beta",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX",
"Programming Language :: Cython",
"Programming Language :: Python :: 2.7",
......@@ -470,10 +471,15 @@ class BuildExt(build_ext):
# Convert flags from gcc to MSVC if required
if self.compiler.compiler_type == 'msvc':
ext.extra_compile_args = [self.COMPILE_ARGS_CONVERTER.get(f, f)
for f in ext.extra_compile_args]
ext.extra_link_args = [self.LINK_ARGS_CONVERTER.get(f, f)
for f in ext.extra_link_args]
extra_compile_args = [self.COMPILE_ARGS_CONVERTER.get(f, f)
for f in ext.extra_compile_args]
# Avoid empty arg
ext.extra_compile_args = [arg for arg in extra_compile_args if arg]
extra_link_args = [self.LINK_ARGS_CONVERTER.get(f, f)
for f in ext.extra_link_args]
# Avoid empty arg
ext.extra_link_args = [arg for arg in extra_link_args if arg]
elif self.compiler.compiler_type == 'unix':
# Avoids runtime symbol collision for manylinux1 platform
......@@ -481,8 +487,17 @@ class BuildExt(build_ext):
extern = 'extern "C" ' if ext.language == 'c++' else ''
return_type = 'void' if sys.version_info[0] <= 2 else 'PyObject*'
ext.extra_compile_args.append(
'''-fvisibility=hidden -D'PyMODINIT_FUNC=%s__attribute__((visibility("default"))) %s ' ''' % (extern, return_type))
ext.extra_compile_args.append('-fvisibility=hidden')
import numpy
numpy_version = [int(i) for i in numpy.version.short_version.split(".", 2)[:2]]
if numpy_version < [1,16]:
ext.extra_compile_args.append(
'''-D'PyMODINIT_FUNC=%s__attribute__((visibility("default"))) %s ' ''' % (extern, return_type))
else:
ext.define_macros.append(
('PyMODINIT_FUNC',
'%s__attribute__((visibility("default"))) %s ' % (extern, return_type)))
def is_debug_interpreter(self):
"""
......@@ -637,7 +652,8 @@ class SourceDistWithCython(sdist):
from Cython.Build import cythonize
cythonize(
self.extensions,
compiler_directives={'embedsignature': True},
compiler_directives={'embedsignature': True,
'language_level': 3},
force=True
)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment