mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 06:24:27 +08:00
Resolve path in get_cached_default_environment() in api/environment.py to
prevent unnecessary cache busting when using pipenv.
This commit is contained in:
committed by
Dave Halter
parent
77a7792afc
commit
8d0c4d3cec
@@ -234,7 +234,12 @@ def _try_get_same_env():
|
|||||||
def get_cached_default_environment():
|
def get_cached_default_environment():
|
||||||
var = os.environ.get('VIRTUAL_ENV')
|
var = os.environ.get('VIRTUAL_ENV')
|
||||||
environment = _get_cached_default_environment()
|
environment = _get_cached_default_environment()
|
||||||
if var and var != environment.path:
|
|
||||||
|
# Under macOS in some cases - notably when using Pipenv - the
|
||||||
|
# sys.prefix of the virtualenv is /path/to/env/bin/.. instead of
|
||||||
|
# /path/to/env so we need to fully resolve the paths in order to
|
||||||
|
# compare them.
|
||||||
|
if var and os.path.realpath(var) != os.path.realpath(environment.path):
|
||||||
_get_cached_default_environment.clear_cache()
|
_get_cached_default_environment.clear_cache()
|
||||||
return _get_cached_default_environment()
|
return _get_cached_default_environment()
|
||||||
return environment
|
return environment
|
||||||
|
|||||||
Reference in New Issue
Block a user