From ba54ab7504570b0ec7b4bddf2a3cebcabf28f3f6 Mon Sep 17 00:00:00 2001 From: Lawrence Mitchell Date: Wed, 17 Apr 2019 09:42:50 +0100 Subject: [PATCH] compilation: Fix for single digit versions --- pyop2/compilation.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pyop2/compilation.py b/pyop2/compilation.py index dc1c1e331..dd4bb7836 100644 --- a/pyop2/compilation.py +++ b/pyop2/compilation.py @@ -85,7 +85,12 @@ def sniff_compiler_version(cc): try: ver = subprocess.check_output([cc, "-dumpversion"], stderr=subprocess.DEVNULL).decode("utf-8") - ver = version.StrictVersion(ver.strip()) + try: + ver = version.StrictVersion(ver.strip()) + except ValueError: + # A sole digit, e.g. 7, results in a ValueError, so + # append a "do-nothing, but make it work" string. + ver = version.StrictVersion(ver.strip() + ".0") if compiler == "gcc" and ver >= version.StrictVersion("7.0"): try: # gcc-7 series only spits out patch level on dumpfullversion.