fix build warnings (#2355)
* fix build warnings * cython fixes * cleanup transformations build * little morepull/2356/head
parent
6b020241c9
commit
96b637737b
11 changed files with 29 additions and 44 deletions
@ -1,42 +1,20 @@ |
|||||||
import os |
|
||||||
import numpy |
import numpy |
||||||
import sysconfig |
|
||||||
|
|
||||||
from Cython.Build import cythonize |
from Cython.Build import cythonize |
||||||
from Cython.Distutils import build_ext |
|
||||||
from distutils.core import Extension, setup # pylint: disable=import-error,no-name-in-module |
from distutils.core import Extension, setup # pylint: disable=import-error,no-name-in-module |
||||||
|
from common.cython_hacks import BuildExtWithoutPlatformSuffix |
||||||
def get_ext_filename_without_platform_suffix(filename): |
|
||||||
name, ext = os.path.splitext(filename) |
|
||||||
ext_suffix = sysconfig.get_config_var('EXT_SUFFIX') |
|
||||||
|
|
||||||
if ext_suffix == ext: |
|
||||||
return filename |
|
||||||
|
|
||||||
ext_suffix = ext_suffix.replace(ext, '') |
|
||||||
idx = name.find(ext_suffix) |
|
||||||
|
|
||||||
if idx == -1: |
|
||||||
return filename |
|
||||||
else: |
|
||||||
return name[:idx] + ext |
|
||||||
|
|
||||||
|
|
||||||
class BuildExtWithoutPlatformSuffix(build_ext): |
|
||||||
def get_ext_filename(self, ext_name): |
|
||||||
filename = super().get_ext_filename(ext_name) |
|
||||||
return get_ext_filename_without_platform_suffix(filename) |
|
||||||
|
|
||||||
|
|
||||||
setup( |
setup( |
||||||
name='Cython transformations wrapper', |
name='Cython transformations wrapper', |
||||||
cmdclass={'build_ext': BuildExtWithoutPlatformSuffix}, |
cmdclass={'build_ext': BuildExtWithoutPlatformSuffix}, |
||||||
ext_modules=cythonize( |
ext_modules=cythonize( |
||||||
Extension( |
Extension( |
||||||
"transformations", |
"transformations", |
||||||
sources=["transformations.pyx"], |
sources=["transformations.pyx"], |
||||||
language="c++", |
language="c++", |
||||||
extra_compile_args=["-std=c++14", "-Wno-nullability-completeness"], |
extra_compile_args=["-std=c++14", "-Wno-cpp"], |
||||||
include_dirs=[numpy.get_include()], |
include_dirs=[numpy.get_include()], |
||||||
|
), |
||||||
|
nthreads=4, |
||||||
) |
) |
||||||
)) |
) |
||||||
|
Loading…
Reference in new issue