mirror of https://github.com/pypa/pip
Refactor virtual env requirement to use the pip.locations func
This commit is contained in:
parent
68288588a3
commit
993a1bfa1b
|
@ -8,6 +8,7 @@ import time
|
|||
import optparse
|
||||
|
||||
from pip import cmdoptions
|
||||
from pip.locations import running_under_virtualenv
|
||||
from pip.log import logger
|
||||
from pip.download import PipSession
|
||||
from pip.exceptions import (BadCommand, InstallationError, UninstallationError,
|
||||
|
@ -105,7 +106,7 @@ class Command(object):
|
|||
|
||||
if options.require_venv:
|
||||
# If a venv is required check if it can really be found
|
||||
if not os.environ.get('VIRTUAL_ENV'):
|
||||
if not running_under_virtualenv():
|
||||
logger.fatal('Could not find an activated virtualenv (required).')
|
||||
sys.exit(VIRTUALENV_NOT_FOUND)
|
||||
|
||||
|
|
Loading…
Reference in New Issue