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


Python locations.distutils_scheme方法代码示例

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


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

示例1: get_lib_location_guesses

# 需要导入模块: from pip import locations [as 别名]
# 或者: from pip.locations import distutils_scheme [as 别名]
def get_lib_location_guesses(*args, **kwargs):
    scheme = distutils_scheme('', *args, **kwargs)
    return [scheme['purelib'], scheme['platlib']] 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:5,代码来源:install.py

示例2: is_local

# 需要导入模块: from pip import locations [as 别名]
# 或者: from pip.locations import distutils_scheme [as 别名]
def is_local(path):
    """
    Return True if this is a path pip is allowed to modify.

    If we're in a virtualenv, sys.prefix points to the virtualenv's
    prefix; only sys.prefix is considered local.

    If we're not in a virtualenv, in general we can modify anything.
    However, if the OS vendor has configured distutils to install
    somewhere other than sys.prefix (which could be a subdirectory of
    sys.prefix, e.g. /usr/local), we consider sys.prefix itself nonlocal
    and the domain of the OS vendor. (In other words, everything _other
    than_ sys.prefix is considered local.)

    """

    path = normalize_path(path)
    prefix = normalize_path(sys.prefix)

    if running_under_virtualenv():
        return path.startswith(normalize_path(sys.prefix))
    else:
        from pip.locations import distutils_scheme
        if path.startswith(prefix):
            for local_path in distutils_scheme("").values():
                if path.startswith(normalize_path(local_path)):
                    return True
            return False
        else:
            return True 
开发者ID:sofia-netsurv,项目名称:python-netsurv,代码行数:32,代码来源:__init__.py

示例3: test_can_find_modules_when_prefix_differ

# 需要导入模块: from pip import locations [as 别名]
# 或者: from pip.locations import distutils_scheme [as 别名]
def test_can_find_modules_when_prefix_differ(monkeypatch):
    """
    context should find the default installed modules, without the help
        of environment variables, even of the pip install location
        differs from ``sys.prefix``
    """

    # store pip location.
    # monkeypatching sys.prefix will side_effect scheme.
    scheme = locations.distutils_scheme('pyang')
    monkeypatch.setattr(
        locations, 'distutils_scheme', lambda *_: scheme)

    # simulate #225 description
    monkeypatch.setattr(sys, 'prefix', '/usr')

    # remove obfuscation from env vars
    if os.environ.get('YANG_INSTALL'):
        del os.environ['YANG_INSTALL']

    if os.environ.get('YANG_MODPATH'):
        del os.environ['YANG_MODPATH']

    ctx = create_context()
    module = ctx.search_module(None, EXISTING_MODULE)
    assert module is not None 
开发者ID:mbj4668,项目名称:pyang,代码行数:28,代码来源:test_prefix_deviation.py

示例4: get_include

# 需要导入模块: from pip import locations [as 别名]
# 或者: from pip.locations import distutils_scheme [as 别名]
def get_include(*args, **kwargs):
    import os
    try:
        from pip import locations
        return os.path.dirname(
            locations.distutils_scheme('pybind11', *args, **kwargs)['headers'])
    except ImportError:
        return 'include' 
开发者ID:apple,项目名称:coremltools,代码行数:10,代码来源:__init__.py


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