本文整理汇总了Python中distutils.command.build_ext.build_ext.build_extensions方法的典型用法代码示例。如果您正苦于以下问题:Python build_ext.build_extensions方法的具体用法?Python build_ext.build_extensions怎么用?Python build_ext.build_extensions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类distutils.command.build_ext.build_ext
的用法示例。
在下文中一共展示了build_ext.build_extensions方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build_extensions
# 需要导入模块: from distutils.command.build_ext import build_ext [as 别名]
# 或者: from distutils.command.build_ext.build_ext import build_extensions [as 别名]
def build_extensions(self):
build_ext_options.build_options(self)
build_ext.build_extensions(self)
# def is_installed(requirement):
# try:
# pkg_resources.require(requirement)
# except pkg_resources.ResolutionError:
# return False
# else:
# return True
# if not is_installed('numpy>=1.11.0') or not is_installed('spacy>=2.1.0'):
# print(textwrap.dedent("""
# Error: requirements needs to be installed first.
# You can install them via:
# $ pip install -r requirements.txt
# """), file=sys.stderr)
# exit(1)
示例2: build_extensions
# 需要导入模块: from distutils.command.build_ext import build_ext [as 别名]
# 或者: from distutils.command.build_ext.build_ext import build_extensions [as 别名]
def build_extensions(self):
ct = self.compiler.compiler_type
opts = self.c_opts.get(ct, [])
if ct == "unix":
opts.append('-DVERSION_INFO="%s"' % self.distribution.get_version())
opts.append(cpp_flag(self.compiler))
if has_flag(self.compiler, "-fvisibility=hidden"):
opts.append("-fvisibility=hidden")
elif ct == "msvc":
opts.append('/DVERSION_INFO=\\"%s\\"' % self.distribution.get_version())
for ext in self.extensions:
if ext.language == "c++":
ext.extra_compile_args += opts
ext.extra_link_args += opts
build_ext.build_extensions(self)
### Build Tools End ###
示例3: build_extensions
# 需要导入模块: from distutils.command.build_ext import build_ext [as 别名]
# 或者: from distutils.command.build_ext.build_ext import build_extensions [as 别名]
def build_extensions(self):
c = self.compiler
_compile = c._compile
def c_compile(obj, src, ext, cc_args, extra_postargs, pp_opts):
cc_args = cc_args + ['-std=c99'] if src.endswith('.c') else cc_args
return _compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
if c.compiler_type == 'unix' and 'gcc' in c.compiler:
c._compile = c_compile
elif self.compiler.compiler_type == "msvc":
if sys.version_info[:2] < (3, 5):
c.include_dirs.extend(['crfsuite/win32'])
build_ext.build_extensions(self)
示例4: build_extensions
# 需要导入模块: from distutils.command.build_ext import build_ext [as 别名]
# 或者: from distutils.command.build_ext.build_ext import build_extensions [as 别名]
def build_extensions(self):
self.compiler.initialize()
self.compiler.compile_options.remove('/MD')
build_ext.build_extensions(self)
示例5: build_extensions
# 需要导入模块: from distutils.command.build_ext import build_ext [as 别名]
# 或者: from distutils.command.build_ext.build_ext import build_extensions [as 别名]
def build_extensions(self):
self.check_cython_extensions(self.extensions)
# Include NumPy
numpy_incl = pkg_resources.resource_filename('numpy', 'core/include')
for ext in self.extensions:
if (hasattr(ext, 'include_dirs') and
numpy_incl not in ext.include_dirs):
ext.include_dirs.append(numpy_incl)
_build_ext.build_extensions(self)
示例6: build_extensions
# 需要导入模块: from distutils.command.build_ext import build_ext [as 别名]
# 或者: from distutils.command.build_ext.build_ext import build_extensions [as 别名]
def build_extensions(self):
c = self.compiler.compiler_type
if c in platform_cflags.keys():
for e in self.extensions:
e.extra_compile_args = platform_cflags[c]
if c in platform_ldflags.keys():
for e in self.extensions:
e.extra_link_args = platform_ldflags[c]
if c in platform_libs.keys():
for e in self.extensions:
try:
e.libraries += platform_libs[c]
except:
e.libraries = platform_libs[c]
build_ext.build_extensions(self)