Skip to content

Commit ddcfd82

Browse files
committed
BLD: Fix conda env libs/includes lookup
Previously `CONDA_DEFAULT_ENV`used to determine the env location but sometimes the value was just an env name. It was fixed too.
1 parent 8b72f2b commit ddcfd82

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

setupext.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,14 @@ def get_base_dirs():
180180
return os.environ.get('MPLBASEDIRLIST').split(os.pathsep)
181181

182182
win_bases = ['win32_static', ]
183-
# on conda windows, we also add the <installdir>\Library of the local interpreter,
183+
# on conda windows, we also add the <conda_env_dir>\Library,
184184
# as conda installs libs/includes there
185-
if os.getenv('CONDA_DEFAULT_ENV'):
186-
win_bases.append(os.path.join(os.getenv('CONDA_DEFAULT_ENV'), "Library"))
185+
# env var names mess: https://github.com/conda/conda/issues/2312
186+
conda_env_path = os.getenv('CONDA_PREFIX') # conda >= 4.1
187+
if not conda_env_path:
188+
conda_env_path = os.getenv('CONDA_DEFAULT_ENV') # conda < 4.1
189+
if conda_env_path and os.path.isdir(conda_env_path):
190+
win_bases.append(os.path.join(conda_env_path, "Library"))
187191

188192
basedir_map = {
189193
'win32': win_bases,

0 commit comments

Comments
 (0)