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 ...@@ -42,13 +42,22 @@ min_version = 5.4
init = init =
import os, subprocess import os, subprocess
parse_version = lambda ver: tuple(map(int, ver.strip().split('.'))) parse_version = lambda ver: tuple(map(int, ver.strip().split('.')))
try: version_set = set()
current = subprocess.check_output(('gcc', '-dumpfullversion'), for command in ('gcc', 'g++', 'gfortran'):
stderr=subprocess.STDOUT, try:
universal_newlines=True).strip() version = subprocess.check_output((command, '-dumpfullversion'),
except subprocess.CalledProcessError: # BBB: old GCC stderr=subprocess.STDOUT,
current = subprocess.check_output(('gcc', '-dumpversion'), universal_newlines=True).strip()
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 self.system_version = current
# If we're still going to use the same GCC, # If we're still going to use the same GCC,
# the conditions have no impact on the dependant parts. # 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