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

Skip to content

Commit 7eb928a

Browse files
committed
Minor cleanups to setupext.
1 parent 9ec4b95 commit 7eb928a

File tree

1 file changed

+7
-23
lines changed

1 file changed

+7
-23
lines changed

setupext.py

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -90,43 +90,27 @@ def _get_xdg_cache_dir():
9090
options['local_freetype'] = lft or options.get('local_freetype', False)
9191

9292

93-
def get_win32_compiler():
94-
"""
95-
Determine the compiler being used on win32.
96-
"""
97-
# Used to determine mingw32 or msvc
98-
# This is pretty bad logic, someone know a better way?
99-
for v in sys.argv:
100-
if 'mingw32' in v:
101-
return 'mingw32'
102-
return 'msvc'
103-
win32_compiler = get_win32_compiler()
104-
105-
10693
def extract_versions():
10794
"""
10895
Extracts version values from the main matplotlib __init__.py and
10996
returns them as a dictionary.
11097
"""
11198
with open('lib/matplotlib/__init__.py') as fd:
11299
for line in fd.readlines():
113-
if (line.startswith('__version__numpy__')):
100+
if line.startswith('__version__numpy__'):
114101
exec(line.strip())
115102
return locals()
116103

117104

118105
def has_include_file(include_dirs, filename):
119106
"""
120-
Returns `True` if `filename` can be found in one of the
121-
directories in `include_dirs`.
107+
Returns `True` if *filename* can be found in one of the
108+
directories in *include_dirs*.
122109
"""
123110
if sys.platform == 'win32':
124-
include_dirs = list(include_dirs) # copy before modify
125-
include_dirs += os.environ.get('INCLUDE', '.').split(os.pathsep)
126-
for dir in include_dirs:
127-
if os.path.exists(os.path.join(dir, filename)):
128-
return True
129-
return False
111+
include_dirs = [*include_dirs, # Don't modify it in-place.
112+
*os.environ.get('INCLUDE', '.').split(os.pathsep)]
113+
return any(pathlib.Path(dir, filename).exists() for dir in include_dirs)
130114

131115

132116
def check_include_file(include_dirs, filename, package):
@@ -150,7 +134,7 @@ def get_base_dirs():
150134
if os.environ.get('MPLBASEDIRLIST'):
151135
return os.environ.get('MPLBASEDIRLIST').split(os.pathsep)
152136

153-
win_bases = ['win32_static', ]
137+
win_bases = ['win32_static']
154138
# on conda windows, we also add the <conda_env_dir>\Library,
155139
# as conda installs libs/includes there
156140
# env var names mess: https://github.com/conda/conda/issues/2312

0 commit comments

Comments
 (0)