當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。