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


Python locations.running_under_virtualenv方法代码示例

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


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

示例1: load_selfcheck_statefile

# 需要导入模块: from pip import locations [as 别名]
# 或者: from pip.locations import running_under_virtualenv [as 别名]
def load_selfcheck_statefile():
    if running_under_virtualenv():
        return VirtualenvSelfCheckState()
    else:
        return GlobalSelfCheckState() 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:7,代码来源:outdated.py

示例2: is_local

# 需要导入模块: from pip import locations [as 别名]
# 或者: from pip.locations import running_under_virtualenv [as 别名]
def is_local(path):
    """
    Return True if path is within sys.prefix, if we're running in a virtualenv.

    If we're not in a virtualenv, all paths are considered "local."

    """
    if not running_under_virtualenv():
        return True
    return normalize_path(path).startswith(normalize_path(sys.prefix)) 
开发者ID:aliyun,项目名称:oss-ftp,代码行数:12,代码来源:util.py

示例3: egg_link_path

# 需要导入模块: from pip import locations [as 别名]
# 或者: from pip.locations import running_under_virtualenv [as 别名]
def egg_link_path(dist):
    """
    Return the path for the .egg-link file if it exists, otherwise, None.

    There's 3 scenarios:
    1) not in a virtualenv
       try to find in site.USER_SITE, then site_packages
    2) in a no-global virtualenv
       try to find in site_packages
    3) in a yes-global virtualenv
       try to find in site_packages, then site.USER_SITE  (don't look in global location)

    For #1 and #3, there could be odd cases, where there's an egg-link in 2 locations.
    This method will just return the first one found.
    """
    sites = []
    if running_under_virtualenv():
        if virtualenv_no_global():
            sites.append(site_packages)
        else:
            sites.append(site_packages)
            if user_site:
                sites.append(user_site)
    else:
        if user_site:
            sites.append(user_site)
        sites.append(site_packages)

    for site in sites:
        egglink = os.path.join(site, dist.project_name) + '.egg-link'
        if os.path.isfile(egglink):
            return egglink 
开发者ID:aliyun,项目名称:oss-ftp,代码行数:34,代码来源:util.py


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