Commit 30965bb2 by Sébastien Eustace

Fix virtualenv detection

parent 77618678
......@@ -5,6 +5,7 @@
### Fixed
- Fixed possible error on some combinations of markers.
- Fixed venv detection so that it only uses `VIRTUAL_ENV` to detect activated virtualenvs.
## [0.12.3] - 2018-10-18
......
......@@ -90,23 +90,19 @@ class Env(object):
return self._bin("pip")
@classmethod
def get(cls, reload=False, cwd=None): # type: (IO, bool) -> Env
def get(cls, reload=False, cwd=None): # type: (bool, Path) -> Env
if cls._env is not None and not reload:
return cls._env
# Check if we are inside a virtualenv or not
in_venv = (
os.environ.get("VIRTUAL_ENV") is not None
or hasattr(sys, "real_prefix")
or (hasattr(sys, "base_prefix") and sys.base_prefix != sys.prefix)
)
in_venv = os.environ.get("VIRTUAL_ENV") is not None
if not in_venv:
# Checking if a local virtualenv exists
if cwd and (cwd / ".venv").exists():
venv = cwd / ".venv"
return VirtualEnv(Path(venv))
return VirtualEnv(venv)
config = Config.create("config.toml")
create_venv = config.setting("settings.virtualenvs.create", True)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment