Python pip.locations.running_under_virtualenv() Examples

The following are 30 code examples of pip.locations.running_under_virtualenv(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module pip.locations , or try the search function .
Example #1
Source File: outdated.py    From ImageFusion with MIT License 5 votes vote down vote up
def load_selfcheck_statefile():
    if running_under_virtualenv():
        return VirtualenvSelfCheckState()
    else:
        return GlobalSelfCheckState() 
Example #2
Source File: util.py    From Flask with Apache License 2.0 5 votes vote down vote up
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 
Example #3
Source File: util.py    From Flask with Apache License 2.0 5 votes vote down vote up
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)) 
Example #4
Source File: util.py    From Flask with Apache License 2.0 5 votes vote down vote up
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 
Example #5
Source File: util.py    From Flask with Apache License 2.0 5 votes vote down vote up
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)) 
Example #6
Source File: outdated.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def load_selfcheck_statefile():
    if running_under_virtualenv():
        return VirtualenvSelfCheckState()
    else:
        return GlobalSelfCheckState() 
Example #7
Source File: outdated.py    From Hands-On-Deep-Learning-for-Games with MIT License 5 votes vote down vote up
def load_selfcheck_statefile():
    if running_under_virtualenv():
        return VirtualenvSelfCheckState()
    else:
        return GlobalSelfCheckState() 
Example #8
Source File: outdated.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def load_selfcheck_statefile():
    if running_under_virtualenv():
        return VirtualenvSelfCheckState()
    else:
        return GlobalSelfCheckState() 
Example #9
Source File: outdated.py    From syntheticmass with Apache License 2.0 5 votes vote down vote up
def load_selfcheck_statefile():
    if running_under_virtualenv():
        return VirtualenvSelfCheckState()
    else:
        return GlobalSelfCheckState() 
Example #10
Source File: outdated.py    From PhonePi_SampleServer with MIT License 5 votes vote down vote up
def load_selfcheck_statefile():
    if running_under_virtualenv():
        return VirtualenvSelfCheckState()
    else:
        return GlobalSelfCheckState() 
Example #11
Source File: outdated.py    From Splunking-Crime with GNU Affero General Public License v3.0 5 votes vote down vote up
def load_selfcheck_statefile():
    if running_under_virtualenv():
        return VirtualenvSelfCheckState()
    else:
        return GlobalSelfCheckState() 
Example #12
Source File: outdated.py    From datafari with Apache License 2.0 5 votes vote down vote up
def load_selfcheck_statefile():
    if running_under_virtualenv():
        return VirtualenvSelfCheckState()
    else:
        return GlobalSelfCheckState() 
Example #13
Source File: outdated.py    From Ansible with MIT License 5 votes vote down vote up
def load_selfcheck_statefile():
    if running_under_virtualenv():
        return VirtualenvSelfCheckState()
    else:
        return GlobalSelfCheckState() 
Example #14
Source File: outdated.py    From python2017 with MIT License 5 votes vote down vote up
def load_selfcheck_statefile():
    if running_under_virtualenv():
        return VirtualenvSelfCheckState()
    else:
        return GlobalSelfCheckState() 
Example #15
Source File: outdated.py    From ImageFusion with MIT License 5 votes vote down vote up
def load_selfcheck_statefile():
    if running_under_virtualenv():
        return VirtualenvSelfCheckState()
    else:
        return GlobalSelfCheckState() 
Example #16
Source File: outdated.py    From recruit with Apache License 2.0 5 votes vote down vote up
def load_selfcheck_statefile():
    if running_under_virtualenv():
        return VirtualenvSelfCheckState()
    else:
        return GlobalSelfCheckState() 
Example #17
Source File: outdated.py    From planespotter with MIT License 5 votes vote down vote up
def load_selfcheck_statefile():
    if running_under_virtualenv():
        return VirtualenvSelfCheckState()
    else:
        return GlobalSelfCheckState() 
Example #18
Source File: outdated.py    From Flask-P2P with MIT License 5 votes vote down vote up
def load_selfcheck_statefile():
    if running_under_virtualenv():
        return VirtualenvSelfCheckState()
    else:
        return GlobalSelfCheckState() 
Example #19
Source File: outdated.py    From python with Apache License 2.0 5 votes vote down vote up
def load_selfcheck_statefile():
    if running_under_virtualenv():
        return VirtualenvSelfCheckState()
    else:
        return GlobalSelfCheckState() 
Example #20
Source File: outdated.py    From Financial-Portfolio-Flask with MIT License 5 votes vote down vote up
def load_selfcheck_statefile():
    if running_under_virtualenv():
        return VirtualenvSelfCheckState()
    else:
        return GlobalSelfCheckState() 
Example #21
Source File: outdated.py    From telegram-robot-rss with Mozilla Public License 2.0 5 votes vote down vote up
def load_selfcheck_statefile():
    if running_under_virtualenv():
        return VirtualenvSelfCheckState()
    else:
        return GlobalSelfCheckState() 
Example #22
Source File: outdated.py    From Safejumper-for-Desktop with GNU General Public License v2.0 5 votes vote down vote up
def load_selfcheck_statefile():
    if running_under_virtualenv():
        return VirtualenvSelfCheckState()
    else:
        return GlobalSelfCheckState() 
Example #23
Source File: outdated.py    From anpr with Creative Commons Attribution 4.0 International 5 votes vote down vote up
def load_selfcheck_statefile():
    if running_under_virtualenv():
        return VirtualenvSelfCheckState()
    else:
        return GlobalSelfCheckState() 
Example #24
Source File: util.py    From oss-ftp with MIT License 5 votes vote down vote up
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 
Example #25
Source File: util.py    From oss-ftp with MIT License 5 votes vote down vote up
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)) 
Example #26
Source File: outdated.py    From vnpy_crypto with MIT License 5 votes vote down vote up
def load_selfcheck_statefile():
    if running_under_virtualenv():
        return VirtualenvSelfCheckState()
    else:
        return GlobalSelfCheckState() 
Example #27
Source File: outdated.py    From kobo-predict with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def load_selfcheck_statefile():
    if running_under_virtualenv():
        return VirtualenvSelfCheckState()
    else:
        return GlobalSelfCheckState() 
Example #28
Source File: outdated.py    From python-netsurv with MIT License 5 votes vote down vote up
def load_selfcheck_statefile():
    if running_under_virtualenv():
        return VirtualenvSelfCheckState()
    else:
        return GlobalSelfCheckState() 
Example #29
Source File: outdated.py    From python-netsurv with MIT License 5 votes vote down vote up
def load_selfcheck_statefile():
    if running_under_virtualenv():
        return VirtualenvSelfCheckState()
    else:
        return GlobalSelfCheckState() 
Example #30
Source File: outdated.py    From jbox with MIT License 5 votes vote down vote up
def load_selfcheck_statefile():
    if running_under_virtualenv():
        return VirtualenvSelfCheckState()
    else:
        return GlobalSelfCheckState()