1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00

Refactor virtual env requirement to use the pip.locations func

This commit is contained in:
Donald Stufft 2013-12-27 01:09:48 -05:00
parent 68288588a3
commit 993a1bfa1b

View file

@ -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)