diff options
author | Matti Picus <matti.picus@gmail.com> | 2018-12-31 19:28:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-31 19:28:57 +0200 |
commit | 1a43137b2b77360175fd530f86808d43bd1f156f (patch) | |
tree | 84ded19103473490c18969f767778e71dbec1b2c /numpy/distutils/fcompiler/environment.py | |
parent | 5e1a89113f69c49c03942dc0d02002c2bebb27a3 (diff) | |
parent | 659ffb0a4ebe9e516568bd5d914e7f1f47513dff (diff) | |
download | numpy-1a43137b2b77360175fd530f86808d43bd1f156f.tar.gz |
Merge pull request #12551 from rgommers/append-warn
MAINT: add warning to numpy.distutils for LDFLAGS append behavior.
Diffstat (limited to 'numpy/distutils/fcompiler/environment.py')
-rw-r--r-- | numpy/distutils/fcompiler/environment.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/numpy/distutils/fcompiler/environment.py b/numpy/distutils/fcompiler/environment.py index 489784580..4238f35cb 100644 --- a/numpy/distutils/fcompiler/environment.py +++ b/numpy/distutils/fcompiler/environment.py @@ -1,6 +1,7 @@ from __future__ import division, absolute_import, print_function import os +import warnings from distutils.dist import Distribution __metaclass__ = type @@ -54,8 +55,18 @@ class EnvironmentConfig(object): if envvar is not None: envvar_contents = os.environ.get(envvar) if envvar_contents is not None: - if var and append and os.environ.get('NPY_DISTUTILS_APPEND_FLAGS', '0') == '1': - var = var + [envvar_contents] + if var and append: + if os.environ.get('NPY_DISTUTILS_APPEND_FLAGS', '0') == '1': + var = var + [envvar_contents] + else: + var = envvar_contents + if 'NPY_DISTUTILS_APPEND_FLAGS' not in os.environ.keys(): + msg = "{} is used as is, not appended ".format(envvar) + \ + "to flags already defined " + \ + "by numpy.distutils! Use NPY_DISTUTILS_APPEND_FLAGS=1 " + \ + "to obtain appending behavior instead (this " + \ + "behavior will become default in a future release)." + warnings.warn(msg, UserWarning, stacklevel=3) else: var = envvar_contents if confvar is not None and self._conf: |