summaryrefslogtreecommitdiff
path: root/numpy/distutils/fcompiler
diff options
context:
space:
mode:
authorYu Feng <rainwoodman@gmail.com>2019-03-02 14:12:04 -0800
committerGitHub <noreply@github.com>2019-03-02 14:12:04 -0800
commita8dedaef26cca77f71ec9caba000339543796bd5 (patch)
tree5a9d17392c5d811fad40fa896adf9c847bfb4f55 /numpy/distutils/fcompiler
parenteb85c3fda4a1a2687745d7ac5d0a96fc94691f77 (diff)
downloadnumpy-a8dedaef26cca77f71ec9caba000339543796bd5.tar.gz
Changes suggested by eric-wieser
Diffstat (limited to 'numpy/distutils/fcompiler')
-rw-r--r--numpy/distutils/fcompiler/environment.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/numpy/distutils/fcompiler/environment.py b/numpy/distutils/fcompiler/environment.py
index 6ad712a3c..4d02bbdbb 100644
--- a/numpy/distutils/fcompiler/environment.py
+++ b/numpy/distutils/fcompiler/environment.py
@@ -51,13 +51,13 @@ class EnvironmentConfig(object):
def _get_var(self, name, conf_desc):
hook, envvar, confvar, convert, append = conf_desc
+ if convert is None: convert = lambda x: x
var = self._hook_handler(name, hook)
if envvar is not None:
envvar_contents = os.environ.get(envvar)
if envvar_contents is not None:
- if convert:
- envvar_contents = convert(envvar_contents)
- if var and append: # in case var is None?
+ envvar_contents = convert(envvar_contents)
+ if var and append:
if os.environ.get('NPY_DISTUTILS_APPEND_FLAGS', '0') == '1':
var.extend(envvar_contents)
else:
@@ -72,13 +72,12 @@ class EnvironmentConfig(object):
else:
var = envvar_contents
if confvar is not None and self._conf:
- # FIXME: conf shall do the conversion immediately after the key is parsed.
- # postpartum conversion will not always catch the right cases.
- var = self._conf.get(confvar, (None, var))[1]
- if convert is not None:
- var = convert(var)
+ if confvar in self._conf:
+ source, confvar_contents = self._conf[convvar]
+ var = convert(confvar_contents)
return var
+
def clone(self, hook_handler):
ec = self.__class__(distutils_section=self._distutils_section,
**self._conf_keys)