From fd2041d209e46a963b6fd572656d3383831ddbd3 Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 2 Jan 2021 18:50:23 +0100 Subject: [PATCH] makepanda: Fix detecting flex version on macOS, more robust checking --- makepanda/makepandacore.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/makepanda/makepandacore.py b/makepanda/makepandacore.py index 04712b9f85..20f63577c8 100644 --- a/makepanda/makepandacore.py +++ b/makepanda/makepandacore.py @@ -558,10 +558,17 @@ def GetFlexVersion(): if not flex: return None - handle = subprocess.Popen(["flex", "--version"], executable=flex, stdout=subprocess.PIPE) - version = handle.communicate()[0].strip().splitlines()[0].split(b' ')[-1] - version = tuple(map(int, version.split(b'.'))) - return version + try: + handle = subprocess.Popen(["flex", "--version"], executable=flex, stdout=subprocess.PIPE) + words = handle.communicate()[0].strip().splitlines()[0].split(b' ') + if words[1] != "version": + version = words[1] + else: + version = words[2] + return tuple(map(int, version.split(b'.'))) + except: + Warn("Unable to detect flex version") + return (0, 0, 0) ######################################################################## ##