diff --git a/gst/parse/get_flex_version.py b/gst/parse/get_flex_version.py new file mode 100644 index 0000000000..643c01cf4b --- /dev/null +++ b/gst/parse/get_flex_version.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python3 + +import re +import sys +import subprocess + +flex = sys.argv[1] + +out = subprocess.check_output([flex, '--version'], universal_newlines=True, + stderr=subprocess.STDOUT, stdin=subprocess.DEVNULL) +print(re.search(r'(\d+\.\d+(\.\d+)?)', out).group()) diff --git a/gst/parse/meson.build b/gst/parse/meson.build index ac3b34de3a..a843398135 100644 --- a/gst/parse/meson.build +++ b/gst/parse/meson.build @@ -6,12 +6,9 @@ flex_cdata = configuration_data() flex_min_version='2.5.31' flex = find_program('flex', 'win_flex') -flexversion_res = run_command([flex, '--version']) -if flexversion_res.returncode() != 0 - error('Could not get flex version (@0@)'.format(flexversion_res.stderr())) -endif - -flexversion = flexversion_res.stdout().split('\n')[0].split(' ')[-1].strip() +get_flex_version = find_program('get_flex_version.py') +flexversion_res = run_command([get_flex_version, flex], check: true) +flexversion = flexversion_res.stdout().strip() if flexversion.version_compare('<' + flex_min_version) error('flex version @0@ >= @1@: NO'.format(flexversion, flex_min_version)) else