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


Python working_set.__init__方法代码示例

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


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

示例1: _needs_hiding

# 需要导入模块: from pkg_resources import working_set [as 别名]
# 或者: from pkg_resources.working_set import __init__ [as 别名]
def _needs_hiding(mod_name):
    """
    >>> _needs_hiding('setuptools')
    True
    >>> _needs_hiding('pkg_resources')
    True
    >>> _needs_hiding('setuptools_plugin')
    False
    >>> _needs_hiding('setuptools.__init__')
    True
    >>> _needs_hiding('distutils')
    True
    >>> _needs_hiding('os')
    False
    >>> _needs_hiding('Cython')
    True
    """
    pattern = re.compile('(setuptools|pkg_resources|distutils|Cython)(\.|$)')
    return bool(pattern.match(mod_name)) 
开发者ID:jpush,项目名称:jbox,代码行数:21,代码来源:sandbox.py

示例2: run_setup

# 需要导入模块: from pkg_resources import working_set [as 别名]
# 或者: from pkg_resources.working_set import __init__ [as 别名]
def run_setup(setup_script, args):
    """Run a distutils setup script, sandboxed in its directory"""
    setup_dir = os.path.abspath(os.path.dirname(setup_script))
    with setup_context(setup_dir):
        try:
            sys.argv[:] = [setup_script]+list(args)
            sys.path.insert(0, setup_dir)
            # reset to include setup dir, w/clean callback list
            working_set.__init__()
            working_set.callbacks.append(lambda dist:dist.activate())
            def runner():
                ns = dict(__file__=setup_script, __name__='__main__')
                _execfile(setup_script, ns)
            DirectorySandbox(setup_dir).run(runner)
        except SystemExit as v:
            if v.args and v.args[0]:
                raise
            # Normal exit, just return 
开发者ID:jpush,项目名称:jbox,代码行数:20,代码来源:sandbox.py

示例3: _needs_hiding

# 需要导入模块: from pkg_resources import working_set [as 别名]
# 或者: from pkg_resources.working_set import __init__ [as 别名]
def _needs_hiding(mod_name):
    """
    >>> _needs_hiding('setuptools')
    True
    >>> _needs_hiding('pkg_resources')
    True
    >>> _needs_hiding('setuptools_plugin')
    False
    >>> _needs_hiding('setuptools.__init__')
    True
    >>> _needs_hiding('distutils')
    True
    >>> _needs_hiding('os')
    False
    >>> _needs_hiding('Cython')
    True
    """
    pattern = re.compile(r'(setuptools|pkg_resources|distutils|Cython)(\.|$)')
    return bool(pattern.match(mod_name)) 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:21,代码来源:sandbox.py

示例4: run_setup

# 需要导入模块: from pkg_resources import working_set [as 别名]
# 或者: from pkg_resources.working_set import __init__ [as 别名]
def run_setup(setup_script, args):
    """Run a distutils setup script, sandboxed in its directory"""
    setup_dir = os.path.abspath(os.path.dirname(setup_script))
    with setup_context(setup_dir):
        try:
            sys.argv[:] = [setup_script] + list(args)
            sys.path.insert(0, setup_dir)
            # reset to include setup dir, w/clean callback list
            working_set.__init__()
            working_set.callbacks.append(lambda dist: dist.activate())

            # __file__ should be a byte string on Python 2 (#712)
            dunder_file = (
                setup_script
                if isinstance(setup_script, str) else
                setup_script.encode(sys.getfilesystemencoding())
            )

            with DirectorySandbox(setup_dir):
                ns = dict(__file__=dunder_file, __name__='__main__')
                _execfile(setup_script, ns)
        except SystemExit as v:
            if v.args and v.args[0]:
                raise
            # Normal exit, just return 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:27,代码来源:sandbox.py

示例5: run_setup

# 需要导入模块: from pkg_resources import working_set [as 别名]
# 或者: from pkg_resources.working_set import __init__ [as 别名]
def run_setup(setup_script, args):
    """Run a distutils setup script, sandboxed in its directory"""
    setup_dir = os.path.abspath(os.path.dirname(setup_script))
    with setup_context(setup_dir):
        try:
            sys.argv[:] = [setup_script] + list(args)
            sys.path.insert(0, setup_dir)
            # reset to include setup dir, w/clean callback list
            working_set.__init__()
            working_set.callbacks.append(lambda dist: dist.activate())

            def runner():
                ns = dict(__file__=setup_script, __name__='__main__')
                _execfile(setup_script, ns)
            DirectorySandbox(setup_dir).run(runner)
        except SystemExit as v:
            if v.args and v.args[0]:
                raise
            # Normal exit, just return 
开发者ID:awemulya,项目名称:kobo-predict,代码行数:21,代码来源:sandbox.py


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