本文整理匯總了Python中distutils.unixccompiler.UnixCCompiler.link方法的典型用法代碼示例。如果您正苦於以下問題:Python UnixCCompiler.link方法的具體用法?Python UnixCCompiler.link怎麽用?Python UnixCCompiler.link使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類distutils.unixccompiler.UnixCCompiler
的用法示例。
在下文中一共展示了UnixCCompiler.link方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get_versions
# 需要導入模塊: from distutils.unixccompiler import UnixCCompiler [as 別名]
# 或者: from distutils.unixccompiler.UnixCCompiler import link [as 別名]
def get_versions():
""" Try to find out the versions of gcc and ld.
If not possible it returns None for it.
"""
from distutils.version import StrictVersion
from distutils.spawn import find_executable
import re
gcc_exe = find_executable('gcc')
if gcc_exe:
out = os.popen(gcc_exe + ' -dumpversion','r')
out_string = out.read()
out.close()
result = re.search('(\d+\.\d+\.\d+)',out_string)
if result:
gcc_version = StrictVersion(result.group(1))
else:
gcc_version = None
else:
gcc_version = None
# EMX ld has no way of reporting version number, and we use GCC
# anyway - so we can link OMF DLLs
ld_version = None
return (gcc_version, ld_version)
示例2: link
# 需要導入模塊: from distutils.unixccompiler import UnixCCompiler [as 別名]
# 或者: from distutils.unixccompiler.UnixCCompiler import link [as 別名]
def link(self,
target_desc,
objects,
output_filename,
output_dir,
libraries,
library_dirs,
runtime_library_dirs,
export_symbols = None,
debug=0,
extra_preargs=None,
extra_postargs=None,
build_temp=None,
target_lang=None):
# Include the appropriate MSVC runtime library if Python was built
# with MSVC >= 7.0 (MinGW standard is msvcrt)
runtime_library = msvc_runtime_library()
if runtime_library:
if not libraries:
libraries = []
libraries.append(runtime_library)
args = (self,
target_desc,
objects,
output_filename,
output_dir,
libraries,
library_dirs,
runtime_library_dirs,
None, #export_symbols, we do this in our def-file
debug,
extra_preargs,
extra_postargs,
build_temp,
target_lang)
if self.gcc_version < "3.0.0":
func = distutils.cygwinccompiler.CygwinCCompiler.link
else:
func = UnixCCompiler.link
func(*args[:func.__code__.co_argcount])
return
示例3: get_versions
# 需要導入模塊: from distutils.unixccompiler import UnixCCompiler [as 別名]
# 或者: from distutils.unixccompiler.UnixCCompiler import link [as 別名]
def get_versions():
""" Try to find out the versions of gcc and ld.
If not possible it returns None for it.
"""
from distutils.version import StrictVersion
from distutils.spawn import find_executable
import re
gcc_exe = find_executable('gcc')
if gcc_exe:
out = os.popen(gcc_exe + ' -dumpversion','r')
try:
out_string = out.read()
finally:
out.close()
result = re.search('(\d+\.\d+\.\d+)',out_string)
if result:
gcc_version = StrictVersion(result.group(1))
else:
gcc_version = None
else:
gcc_version = None
# EMX ld has no way of reporting version number, and we use GCC
# anyway - so we can link OMF DLLs
ld_version = None
return (gcc_version, ld_version)
示例4: link
# 需要導入模塊: from distutils.unixccompiler import UnixCCompiler [as 別名]
# 或者: from distutils.unixccompiler.UnixCCompiler import link [as 別名]
def link(self,
target_desc,
objects,
output_filename,
output_dir,
libraries,
library_dirs,
runtime_library_dirs,
export_symbols = None,
debug=0,
extra_preargs=None,
extra_postargs=None,
build_temp=None,
target_lang=None):
# Include the appropiate MSVC runtime library if Python was built
# with MSVC >= 7.0 (MinGW standard is msvcrt)
runtime_library = msvc_runtime_library()
if runtime_library:
if not libraries:
libraries = []
libraries.append(runtime_library)
args = (self,
target_desc,
objects,
output_filename,
output_dir,
libraries,
library_dirs,
runtime_library_dirs,
None, #export_symbols, we do this in our def-file
debug,
extra_preargs,
extra_postargs,
build_temp,
target_lang)
if self.gcc_version < "3.0.0":
func = distutils.cygwinccompiler.CygwinCCompiler.link
else:
func = UnixCCompiler.link
func(*args[:func.__code__.co_argcount])
return
示例5: get_msvcr
# 需要導入模塊: from distutils.unixccompiler import UnixCCompiler [as 別名]
# 或者: from distutils.unixccompiler.UnixCCompiler import link [as 別名]
def get_msvcr():
"""Include the appropriate MSVC runtime library if Python was built
with MSVC 7.0 or later.
"""
# FIXME: next code is from issue870382
# MS C-runtime libraries never support backward compatibility.
# Linking to a different library without to specify correct runtime
# version for the headers will link renamed functions to msvcrt.
# See issue3308: this piece of code is python problem even
# with correct w32api headers.
# Issue: for MSVC compiler we can get the version and from version
# to determine mcvcrt as code below. But what about if python is
# build with GCC compiler?
# Output of sys.version is information for python build on first
# line, on the next line is information for the compiler and the
# output lack information for the C-runtime.
msc_pos = sys.version.find('MSC v.')
if msc_pos != -1:
msc_ver = sys.version[msc_pos+6:msc_pos+10]
if msc_ver == '1300':
# MSVC 7.0
return ['msvcr70']
elif msc_ver == '1310':
# MSVC 7.1
return ['msvcr71']
elif msc_ver == '1400':
# VS2005 / MSVC 8.0
return ['msvcr80']
elif msc_ver == '1500':
# VS2008 / MSVC 9.0
return ['msvcr90']
else:
raise ValueError("Unknown MS Compiler version %s " % msc_ver)
else:
return []
示例6: _init_posix
# 需要導入模塊: from distutils.unixccompiler import UnixCCompiler [as 別名]
# 或者: from distutils.unixccompiler.UnixCCompiler import link [as 別名]
def _init_posix():
old_init_posix()
ld = distutils.sysconfig._config_vars['LDSHARED']
# distutils.sysconfig._config_vars['LDSHARED'] = ld.replace('gcc','g++')
# FreeBSD names gcc as cc, so the above find and replace doesn't work.
# So, assume first entry in ld is the name of the linker -- gcc or cc or
# whatever. This is a sane assumption, correct?
# If the linker is gcc, set it to g++
link_cmds = ld.split()
if gcc_exists(link_cmds[0]):
link_cmds[0] = 'g++'
ld = ' '.join(link_cmds)
if (sys.platform == 'darwin'):
# The Jaguar distributed python 2.2 has -arch i386 in the link line
# which doesn't seem right. It omits all kinds of warnings, so
# remove it.
ld = ld.replace('-arch i386','')
# The following line is a HACK to fix a problem with building the
# freetype shared library under Mac OS X:
ld += ' -framework AppKit'
# 2.3a1 on OS X emits a ton of warnings about long double. OPT
# appears to not have all the needed flags set while CFLAGS does.
cfg_vars = distutils.sysconfig._config_vars
cfg_vars['OPT'] = cfg_vars['CFLAGS']
distutils.sysconfig._config_vars['LDSHARED'] = ld