本文整理汇总了Python中setuptools.Extension._needs_stub方法的典型用法代码示例。如果您正苦于以下问题:Python Extension._needs_stub方法的具体用法?Python Extension._needs_stub怎么用?Python Extension._needs_stub使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类setuptools.Extension
的用法示例。
在下文中一共展示了Extension._needs_stub方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build_extensions
# 需要导入模块: from setuptools import Extension [as 别名]
# 或者: from setuptools.Extension import _needs_stub [as 别名]
#.........这里部分代码省略.........
for d in os.environ[k].split(os.path.pathsep):
_add_directory(library_dirs, d)
prefix = dsc.get_config_var("prefix")
if prefix:
_add_directory(library_dirs, os.path.join(prefix, "lib"))
_add_directory(include_dirs, os.path.join(prefix, "include"))
if sys.platform == "darwin":
# fink installation directories
_add_directory(library_dirs, "/sw/lib")
_add_directory(include_dirs, "/sw/include")
# darwin ports installation directories
_add_directory(library_dirs, "/opt/local/lib")
_add_directory(include_dirs, "/opt/local/include")
# if Homebrew is installed, use its lib and include directories
import subprocess
try:
prefix = subprocess.check_output(
['brew', '--prefix']
).strip().decode('latin1')
except:
# Homebrew not installed
prefix = None
if prefix:
# add Homebrew's include and lib directories
_add_directory(library_dirs, os.path.join(prefix, 'lib'))
_add_directory(include_dirs, os.path.join(prefix, 'include'))
elif sys.platform.startswith("linux"):
arch_tp = (plat.processor(), plat.architecture()[0])
if arch_tp == ("x86_64", "32bit"):
# 32 bit build on 64 bit machine.
_add_directory(library_dirs, "/usr/lib/i386-linux-gnu")
else:
for platform_ in arch_tp:
if not platform_:
continue
if platform_ in ["x86_64", "64bit"]:
_add_directory(library_dirs, "/lib64")
_add_directory(library_dirs, "/usr/lib64")
_add_directory(
library_dirs, "/usr/lib/x86_64-linux-gnu")
break
elif platform_ in ["i386", "i686", "32bit"]:
_add_directory(
library_dirs, "/usr/lib/i386-linux-gnu")
break
elif platform_ in ["aarch64"]:
_add_directory(library_dirs, "/usr/lib64")
_add_directory(
library_dirs, "/usr/lib/aarch64-linux-gnu")
break
else:
raise ValueError(
"Unable to identify Linux platform: `%s`" % platform_)
self.compiler.library_dirs = library_dirs + self.compiler.library_dirs
self.compiler.include_dirs = include_dirs + self.compiler.include_dirs
pylib = "python{}".format(sys.version[:3])
if sys.version[:3] == '3.4':
pylib += 'm'
libs = [pylib]
if _find_include_file(self, "jpeglib.h"):
if _find_library_file(self, "jpeg"):
libs.append('jpeg')
else:
raise ValueError("Unable to find libjpeg")
else:
raise ValueError("Unable to find jpeglib.h")
if _find_include_file(self, "boost/thread.hpp"):
if _find_library_file(self, "boost_thread"):
libs.append("boost_thread")
elif _find_library_file(self, "boost_thread-mt"):
libs.append("boost_thread-mt")
else:
raise ValueError("Unable to find libboost_thread")
if _find_library_file(self, "boost_system"):
libs.append("boost_system")
elif _find_library_file(self, "boost_system-mt"):
libs.append("boost_system-mt")
else:
raise ValueError("Unable to find libboost_system")
else:
raise ValueError("Unable to find boost headers")
print(libs)
iwt = Extension('_ImgWorker', sources=['imgworker.cpp'],
include_dirs=self.compiler.include_dirs,
library_dirs=self.compiler.library_dirs,
libraries=libs)
iwt._needs_stub = False
exts = [iwt]
self.extensions[:] = exts
build_ext.build_extensions(self)