Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c465993

Browse files
authored
Merge pull request #9510 from Kojoley/bld-fix-some-bugs
BLD: Fix some bugs in `setupext.py`
2 parents 2ed9013 + d527a82 commit c465993

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

setupext.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ def has_include_file(include_dirs, filename):
151151
directories in `include_dirs`.
152152
"""
153153
if sys.platform == 'win32':
154-
include_dirs += os.environ.get('INCLUDE', '.').split(';')
154+
include_dirs = list(include_dirs) # copy before modify
155+
include_dirs += os.environ.get('INCLUDE', '.').split(os.pathsep)
155156
for dir in include_dirs:
156157
if os.path.exists(os.path.join(dir, filename)):
157158
return True
@@ -180,10 +181,14 @@ def get_base_dirs():
180181
return os.environ.get('MPLBASEDIRLIST').split(os.pathsep)
181182

182183
win_bases = ['win32_static', ]
183-
# on conda windows, we also add the <installdir>\Library of the local interpreter,
184+
# on conda windows, we also add the <conda_env_dir>\Library,
184185
# 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"))
186+
# env var names mess: https://github.com/conda/conda/issues/2312
187+
conda_env_path = os.getenv('CONDA_PREFIX') # conda >= 4.1
188+
if not conda_env_path:
189+
conda_env_path = os.getenv('CONDA_DEFAULT_ENV') # conda < 4.1
190+
if conda_env_path and os.path.isdir(conda_env_path):
191+
win_bases.append(os.path.join(conda_env_path, "Library"))
187192

188193
basedir_map = {
189194
'win32': win_bases,

0 commit comments

Comments
 (0)