Skip to content

Commit

Permalink
Update noxfile.py
Browse files Browse the repository at this point in the history
Co-authored-by: Lukas Atkinson <opensource@LukasAtkinson.de>
  • Loading branch information
Spacetown and latk committed Oct 25, 2022
1 parent d2bef0b commit cc91a26
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,17 @@ def get_gcc_version_to_use():
# This is free software; see the source for copying conditions. There is NO
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
output = subprocess.check_output([CC, "--version"]).decode().split("\n")
if output[0].startswith("gcc"):
version = output[0].split(" ")[-1]
major_version = version.split(".")[0]
# look for a line "gcc WHATEVER VERSION.WHATEVER"
search_gcc_version = re.search(r"^gcc\b.* ([0-9]+)\.\S+$", output, re.M)

# look for a line "WHATEVER clang version VERSION.WHATEVER"
search_clang_version = re.search(r"\bclang version ([0-9]+)\.")

if search_gcc_version:
major_version = search_gcc_version.group(1)
CC = f"gcc-{major_version}"
elif " clang version " in output[0]:
version = output[0].split(" clang version ")[1]
major_version = version.split(".")[0]
elif search_clang_version:
major_version = search_clang_version.group(1)
CC = f"clang-{major_version}"

if CC not in GCC_VERSIONS:
Expand Down

0 comments on commit cc91a26

Please sign in to comment.