当前位置: 首页>>代码示例>>Python>>正文


Python sysconfig.customize_compiler方法代码示例

本文整理汇总了Python中distutils.sysconfig.customize_compiler方法的典型用法代码示例。如果您正苦于以下问题:Python sysconfig.customize_compiler方法的具体用法?Python sysconfig.customize_compiler怎么用?Python sysconfig.customize_compiler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在distutils.sysconfig的用法示例。


在下文中一共展示了sysconfig.customize_compiler方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _customize_compiler_for_shlib

# 需要导入模块: from distutils import sysconfig [as 别名]
# 或者: from distutils.sysconfig import customize_compiler [as 别名]
def _customize_compiler_for_shlib(compiler):
    if sys.platform == "darwin":
        # building .dylib requires additional compiler flags on OSX; here we
        # temporarily substitute the pyconfig.h variables so that distutils'
        # 'customize_compiler' uses them before we build the shared libraries.
        tmp = _CONFIG_VARS.copy()
        try:
            # XXX Help!  I don't have any idea whether these are right...
            _CONFIG_VARS['LDSHARED'] = (
                "gcc -Wl,-x -dynamiclib -undefined dynamic_lookup")
            _CONFIG_VARS['CCSHARED'] = " -dynamiclib"
            _CONFIG_VARS['SO'] = ".dylib"
            customize_compiler(compiler)
        finally:
            _CONFIG_VARS.clear()
            _CONFIG_VARS.update(tmp)
    else:
        customize_compiler(compiler) 
开发者ID:sofia-netsurv,项目名称:python-netsurv,代码行数:20,代码来源:build_ext.py

示例2: _missing_compiler_executable

# 需要导入模块: from distutils import sysconfig [as 别名]
# 或者: from distutils.sysconfig import customize_compiler [as 别名]
def _missing_compiler_executable(cmd_names=[]):
    """Check if the compiler components used to build the interpreter exist.

    Check for the existence of the compiler executables whose names are listed
    in 'cmd_names' or all the compiler executables when 'cmd_names' is empty
    and return the first missing executable or None when none is found
    missing.

    """
    from distutils import ccompiler, sysconfig, spawn
    compiler = ccompiler.new_compiler()
    sysconfig.customize_compiler(compiler)
    for name in compiler.executables:
        if cmd_names and name not in cmd_names:
            continue
        cmd = getattr(compiler, name)
        if cmd_names:
            assert cmd is not None, \
                    "the '%s' executable is not configured" % name
        elif not cmd:
            continue
        if spawn.find_executable(cmd[0]) is None:
            return cmd[0] 
开发者ID:pypa,项目名称:setuptools,代码行数:25,代码来源:py35compat.py

示例3: test_osx_cc_overrides_ldshared

# 需要导入模块: from distutils import sysconfig [as 别名]
# 或者: from distutils.sysconfig import customize_compiler [as 别名]
def test_osx_cc_overrides_ldshared(self):
        # Issue #18080:
        # ensure that setting CC env variable also changes default linker
        def gcv(v):
            if v == 'LDSHARED':
                return 'gcc-4.2 -bundle -undefined dynamic_lookup '
            return 'gcc-4.2'

        def gcvs(*args, _orig=sysconfig.get_config_vars):
            if args:
                return list(map(sysconfig.get_config_var, args))
            return _orig()
        sysconfig.get_config_var = gcv
        sysconfig.get_config_vars = gcvs
        with EnvironmentVarGuard() as env:
            env['CC'] = 'my_cc'
            del env['LDSHARED']
            sysconfig.customize_compiler(self.cc)
        self.assertEqual(self.cc.linker_so[0], 'my_cc') 
开发者ID:pypa,项目名称:setuptools,代码行数:21,代码来源:test_unixccompiler.py

示例4: test_osx_explicit_ldshared

# 需要导入模块: from distutils import sysconfig [as 别名]
# 或者: from distutils.sysconfig import customize_compiler [as 别名]
def test_osx_explicit_ldshared(self):
        # Issue #18080:
        # ensure that setting CC env variable does not change
        #   explicit LDSHARED setting for linker
        def gcv(v):
            if v == 'LDSHARED':
                return 'gcc-4.2 -bundle -undefined dynamic_lookup '
            return 'gcc-4.2'

        def gcvs(*args, _orig=sysconfig.get_config_vars):
            if args:
                return list(map(sysconfig.get_config_var, args))
            return _orig()
        sysconfig.get_config_var = gcv
        sysconfig.get_config_vars = gcvs
        with EnvironmentVarGuard() as env:
            env['CC'] = 'my_cc'
            env['LDSHARED'] = 'my_ld -bundle -dynamic'
            sysconfig.customize_compiler(self.cc)
        self.assertEqual(self.cc.linker_so[0], 'my_ld') 
开发者ID:pypa,项目名称:setuptools,代码行数:22,代码来源:test_unixccompiler.py


注:本文中的distutils.sysconfig.customize_compiler方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。