本文整理汇总了Python中setuptools.command.build_ext.build_ext.finalize_options函数的典型用法代码示例。如果您正苦于以下问题:Python finalize_options函数的具体用法?Python finalize_options怎么用?Python finalize_options使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了finalize_options函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: finalize_options
def finalize_options(self):
build_ext.finalize_options(self)
if self.compiler is None:
compiler = get_default_compiler()
else:
compiler = self.compiler
if compiler == "msvc":
# Add msvc specific hacks
if (sys.version_info.major, sys.version_info.minor) < (3, 3):
# The check above is a nasty hack. We're using the python
# version as a proxy for the MSVC version. 2008 doesn't
# have stdint.h, so is needed. 2010 does.
#
# We need to add the path to msvc includes
include_dirs.append(os.path.join(os.getcwd(), "include", "msvc_2008"))
# We need to prepend lib to all the library names
_libraries = []
for each_lib in self.libraries:
_libraries.append("lib" + each_lib)
self.libraries = _libraries
示例2: finalize_options
def finalize_options(self):
from Cython.Build import cythonize
self.distribution.ext_modules[:] = cythonize(
self.distribution.ext_modules,
compiler_directives={'embedsignature': True},
)
_build_ext.finalize_options(self)
示例3: finalize_options
def finalize_options(self):
# Validate the --enable-openmp and --disable-openmp command line options:
# the user should provide at most one of them.
if self.enable_openmp and self.disable_openmp:
raise _DistutilsOptionError("--enable-openmp and --disable-openmp are mutually exclusive")
# Chain to method in parent class.
_build_ext.finalize_options(self)
示例4: finalize_options
def finalize_options(self):
_build_ext.finalize_options(self)
# Prevent numpy from thinking it is still in its setup process
__builtins__.__NUMPY_SETUP__ = False
print('build_ext: including numpy files')
import numpy
self.include_dirs.append(numpy.get_include())
示例5: finalize_options
def finalize_options(self):
build_ext.finalize_options(self)
import builtins
# Prevent numpy from thinking it is still in its setup process:
builtins.__NUMPY_SETUP__ = False
import numpy
self.include_dirs.append(numpy.get_include())
示例6: finalize_options
def finalize_options(self):
_build_ext.finalize_options(self)
# Prevent numpy from thinking it is still in its setup process:
if hasattr(__builtins__, '__NUMPY_SETUP__'):
__builtins__.__NUMPY_SETUP__ = False
import numpy
self.include_dirs.append(numpy.get_include())
示例7: finalize_options
def finalize_options(self):
build_ext.finalize_options(self)
if not self.distribution.has_c_libraries():
return
# Go through individual extensions and set their rpath variable and
# library search paths
build_clib = self.get_finalized_command("build_clib")
libnames = [libname for libname, _ in build_clib.libraries]
rpaths_abs = [os.path.dirname(build_clib.get_fullpath(lib))
for lib in build_clib.libraries]
rpaths_abs = list(set(rpaths_abs))
libdirs = [os.path.join(build_clib.build_clib, p)
for p in rpaths_abs]
for ext in self.extensions:
ext_path = self.get_ext_filename(ext.name)
rpaths_rel = [os.path.relpath(p, os.path.dirname(ext_path))
for p in rpaths_abs]
ext.runtime_library_dirs.extend(
["$ORIGIN/{}".format(p) for p in rpaths_rel])
ext.libraries.extend(libnames)
ext.library_dirs.extend(libdirs)
示例8: finalize_options
def finalize_options(self):
_build_ext.finalize_options(self)
# prevent numpy from thinking it is still in its setup process
__builtins__.__NUMPY_SETUP__ = False
import numpy
# place numpy includes first, see gh #156
self.include_dirs.insert(0, numpy.get_include())
示例9: finalize_options
def finalize_options(self):
options_pairs = []
if not self.with_mysql_capi:
options_pairs.append(('with_mysql_capi', 'with_mysql_capi'))
if not self.with_protobuf_include_dir:
options_pairs.append(('with_protobuf_include_dir',
'with_protobuf_include_dir'))
if not self.with_protobuf_lib_dir:
options_pairs.append(('with_protobuf_lib_dir',
'with_protobuf_lib_dir'))
if not self.with_protoc:
options_pairs.append(('with_protoc', 'with_protoc'))
if options_pairs:
self.set_undefined_options('install', *options_pairs)
build_ext.finalize_options(self)
print("# Python architecture: {0}".format(py_arch))
print("# Python ARCH_64BIT: {0}".format(ARCH_64BIT))
self.connc_lib = os.path.join(self.build_temp, 'connc', 'lib')
self.connc_include = os.path.join(self.build_temp, 'connc', 'include')
self.protobuf_lib = os.path.join(self.build_temp, 'protobuf', 'lib')
self.protobuf_include = os.path.join(self.build_temp, 'protobuf', 'include')
if self.with_mysql_capi:
self._finalize_connector_c(self.with_mysql_capi)
if not self.with_protobuf_include_dir:
self.with_protobuf_include_dir = \
os.environ.get("MYSQLXPB_PROTOBUF_INCLUDE_DIR")
if not self.with_protobuf_lib_dir:
self.with_protobuf_lib_dir = \
os.environ.get("MYSQLXPB_PROTOBUF_LIB_DIR")
if not self.with_protoc:
self.with_protoc = os.environ.get("MYSQLXPB_PROTOC")
if self.with_protobuf_include_dir:
print("# Protobuf include directory: {0}"
"".format(self.with_protobuf_include_dir))
else:
log.error("Unable to find Protobuf include directory.")
sys.exit(1)
if self.with_protobuf_lib_dir:
print("# Protobuf library directory: {0}"
"".format(self.with_protobuf_lib_dir))
else:
log.error("Unable to find Protobuf library directory.")
sys.exit(1)
if self.with_protoc:
print("# Protobuf protoc binary: {0}".format(self.with_protoc))
else:
log.error("Unable to find Protobuf protoc binary.")
sys.exit(1)
self._finalize_protobuf()
示例10: finalize_options
def finalize_options(self):
self.set_undefined_options('build')
try:
r_home = subprocess.check_output(("R", "RHOME"),
universal_newlines=True)
except:
raise SystemExit("Error: Tried to guess R's HOME but no R command in the PATH.")
r_home = r_home.split(os.linesep)
#Twist if 'R RHOME' spits out a warning
if r_home[0].startswith("WARNING"):
r_home = r_home[1].rstrip()
else:
r_home = r_home[0].rstrip()
rexec = RExec(r_home)
if rexec.version[0] == 'development' or \
cmp_version(rexec.version[:2], [2, 8]) == -1:
if self.ignore_check_rversion:
warnings.warn("R did not seem to have the minimum required version number")
else:
raise SystemExit("Error: R >= 2.8 required (and R told '%s')." %'.'.join(rexec.version))
try:
super(build_ext, self).finalize_options()
except TypeError:
# distutils parent class an old style Python class
_build_ext.finalize_options(self)
示例11: finalize_options
def finalize_options(self):
_build_ext.finalize_options(self)
self.set_undefined_options("build",
("force_pyx_compile", "force_pyx_compile"),
("force_template_update", "force_template_update")
)
示例12: finalize_options
def finalize_options(self):
print("Finalizing options")
_build_ext.finalize_options(self)
# Prevent numpy from thinking it is still in its setup process:
__builtins__.__NUMPY_SETUP__ = False
import numpy
self.include_dirs.append(numpy.get_include())
示例13: finalize_options
def finalize_options(self):
build_ext.finalize_options(self)
if self.compiler is None:
compiler = get_default_compiler()
else:
compiler = self.compiler
示例14: finalize_options
def finalize_options(self):
_build_ext.finalize_options(self)
# Before importing numpy, we need to make sure it doesn't think it
# is still during its setup process:
__builtins__.__NUMPY_SETUP__ = False
import numpy
# Add location of numpy headers:
self.include_dirs.append(numpy.get_include())
示例15: finalize_options
def finalize_options(self):
self.set_undefined_options('install',
('with_mysql_capi', 'with_mysql_capi'))
build_ext.finalize_options(self)
if self.with_mysql_capi:
self._finalize_connector_c(self.with_mysql_capi)