summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authormattip <matti.picus@gmail.com>2020-06-16 22:58:18 +0300
committermattip <matti.picus@gmail.com>2020-06-16 22:58:18 +0300
commiteab6af0ae7773bf4dc1ee2653a59da2c274b8ff3 (patch)
treef5b80c37aa0ca616e5fed10933d9fbd0ee8a4710 /setup.py
parent04883a6da43f460417b3e1add3a5807032557828 (diff)
downloadnumpy-eab6af0ae7773bf4dc1ee2653a59da2c274b8ff3.tar.gz
BLD: use '-dumpversion' to get gcc version
Diffstat (limited to 'setup.py')
-rwxr-xr-xsetup.py22
1 files changed, 7 insertions, 15 deletions
diff --git a/setup.py b/setup.py
index 2679015ad..6219254f0 100755
--- a/setup.py
+++ b/setup.py
@@ -237,24 +237,16 @@ def get_build_overrides():
def _is_using_old_gcc(obj):
is_old_gcc = False
if obj.compiler.compiler_type == 'unix':
- cc = sysconfig.get_config_var("CC")
- if not cc:
- cc = ""
- compiler_name = os.path.basename(cc)
- if "gcc" in compiler_name:
- out = subprocess.run(['gcc', '-dM', '-E', '-'],
- stdin=subprocess.DEVNULL,
+ cc = obj.compiler.compiler[0]
+ if cc == "gcc":
+ out = subprocess.run([cc, '-dumpversion'],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)
- for line in out.stdout.split(b'\n'):
- if b'__STDC_VERSION__' in line:
- # line is something like
- # #define __STDC_VERSION__ 201710L
- val = line.split(b' ')[-1]
- if val < b'199901L':
- # before c99, so we must add it ourselves
- is_old_gcc = True
+ ver = float(out.stdout)
+ if ver < 6:
+ # perhaps 5 is OK?
+ is_old_gcc = True
return is_old_gcc
class new_build_clib(build_clib):