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


Python DirectorySandbox._violation方法代码示例

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


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

示例1: _no_sandbox

# 需要导入模块: from setuptools.sandbox import DirectorySandbox [as 别名]
# 或者: from setuptools.sandbox.DirectorySandbox import _violation [as 别名]
def _no_sandbox(function):
    def __no_sandbox(*args, **kw):
        try:
            from setuptools.sandbox import DirectorySandbox
            if not hasattr(DirectorySandbox, '_old'):
                def violation(*args):
                    pass
                DirectorySandbox._old = DirectorySandbox._violation
                DirectorySandbox._violation = violation
                patched = True
            else:
                patched = False
        except ImportError:
            patched = False

        try:
            return function(*args, **kw)
        finally:
            if patched:
                DirectorySandbox._violation = DirectorySandbox._old
                del DirectorySandbox._old

    return __no_sandbox 
开发者ID:bunbun,项目名称:nested-dict,代码行数:25,代码来源:ez_setup.py

示例2: disable_sandbox

# 需要导入模块: from setuptools.sandbox import DirectorySandbox [as 别名]
# 或者: from setuptools.sandbox.DirectorySandbox import _violation [as 别名]
def disable_sandbox():
    """
    When capstone/keystone is installed as a dependency, setuptools
    throws a SandboxViolation when it tries to create a
    directory for its shared library. Just disable the
    sandbox as a hacky workaround for now.

    nb.
    """

    try:
        from setuptools.sandbox import DirectorySandbox
        def violation(operation, *args, **_):
            """
            Print stup for DirectorySandbox violation function.
            """
            print("SandboxViolation (disabled): {} {}".format(operation, args))

        # pylint: disable=W0212
        DirectorySandbox._violation = violation
    except ImportError:
        pass 
开发者ID:0xbc,项目名称:chiasm-shell,代码行数:24,代码来源:setup.py

示例3: _rename_path

# 需要导入模块: from setuptools.sandbox import DirectorySandbox [as 别名]
# 或者: from setuptools.sandbox.DirectorySandbox import _violation [as 别名]
def _rename_path(path):
    new_name = path + '.OLD.%s' % time.time()
    log.warn('Renaming %s into %s', path, new_name)
    try:
        from setuptools.sandbox import DirectorySandbox
        def _violation(*args):
            pass
        DirectorySandbox._violation = _violation
    except ImportError:
        pass

    os.rename(path, new_name)
    return new_name 
开发者ID:arcpy,项目名称:sample-gp-tools,代码行数:15,代码来源:distribute_setup.py


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