Commit 4a93406d authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

component/default: system gcc can be used only if all gcc, g++ and gfortran...

component/default: system gcc can be used only if all gcc, g++ and gfortran exist and their versions are same.
parent 5dddfce6
......@@ -42,13 +42,22 @@ min_version = 5.4
init =
import os, subprocess
parse_version = lambda ver: tuple(map(int, ver.strip().split('.')))
try:
current = subprocess.check_output(('gcc', '-dumpfullversion'),
stderr=subprocess.STDOUT,
universal_newlines=True).strip()
except subprocess.CalledProcessError: # BBB: old GCC
current = subprocess.check_output(('gcc', '-dumpversion'),
universal_newlines=True).strip()
version_set = set()
for command in ('gcc', 'g++', 'gfortran'):
try:
version = subprocess.check_output((command, '-dumpfullversion'),
stderr=subprocess.STDOUT,
universal_newlines=True).strip()
except subprocess.CalledProcessError: # BBB: old GCC
version = subprocess.check_output((command, '-dumpversion'),
universal_newlines=True).strip()
except FileNotFoundError:
version = None
version_set.add(version)
if None in version_set or len(version_set) != 1:
current = '0.0.0'
else:
current, = version_set
self.system_version = current
# If we're still going to use the same GCC,
# the conditions have no impact on the dependant parts.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment