Update distutils for openmp and new version of pip

This commit is contained in:
2019-02-19 17:30:53 +01:00
parent 29c56572cf
commit 52de6f2717
31 changed files with 114 additions and 44 deletions

28
distutils.ext/obidistutils/command/build_ext.py Executable file → Normal file
View File

@ -7,9 +7,21 @@ Created on 13 fevr. 2014
from distutils import log
import os
from distutils import sysconfig
from distutils.errors import DistutilsSetupError
def _customize_compiler(compiler):
compilername = compiler.compiler[0]
if ("gcc" in compilername or "g++" in compilername):
cc_cmd = ' '.join(compiler.compiler + ['-fopenmp'])
ccshared= ' '.join(x for x in sysconfig.get_config_vars("ccshared") if x is not None)
compiler.set_executables(
compiler=cc_cmd,
compiler_so=cc_cmd + ' ' + ccshared
)
try:
from Cython.Distutils import build_ext as ori_build_ext # @UnresolvedImport
from Cython.Compiler import Options as cython_options # @UnresolvedImport
@ -28,7 +40,8 @@ try:
def finalize_options(self):
ori_build_ext.finalize_options(self) # @UndefinedVariable
super(build_ext, self).finalize_options()
self.set_undefined_options('littlebigman',
('littlebigman', 'littlebigman'))
@ -85,6 +98,14 @@ try:
ext.sources = self.cython_sources(ext.sources, ext)
self.build_extension(ext)
def build_extensions(self):
if hasattr(self, 'compiler'):
_customize_compiler(self.compiler)
if hasattr(self, 'shlib_compiler'):
_customize_compiler(self.shlib_compiler)
ori_build_ext.build_extensions(self)
def run(self):
self.modifyDocScripts()
@ -104,8 +125,7 @@ try:
sub_commands = [('build_files',has_files),
('build_cexe', has_executables)
] + \
ori_build_ext.sub_commands
] + ori_build_ext.sub_commands
except ImportError:
from distutils.command import build_ext # @UnusedImport