mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-26 18:20:44 +00:00
meson: Extract flex version using a regex inside a script
Different builds of Flex on different platforms output different strings in --version. For example: macOS: flex 2.5.35 Apple(flex-31) Windows: win_flex.exe 2.6.4 C:\Program Files (x86)\GnuWin32\bin\flex.EXE version 2.5.4 We need to look for a string that looks like a version, which means a regex till https://github.com/mesonbuild/meson/issues/1609 is fixed. Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/356
This commit is contained in:
parent
febfabb39f
commit
c164b88ac1
2 changed files with 14 additions and 6 deletions
11
gst/parse/get_flex_version.py
Normal file
11
gst/parse/get_flex_version.py
Normal file
|
@ -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())
|
|
@ -6,12 +6,9 @@ flex_cdata = configuration_data()
|
||||||
flex_min_version='2.5.31'
|
flex_min_version='2.5.31'
|
||||||
flex = find_program('flex', 'win_flex')
|
flex = find_program('flex', 'win_flex')
|
||||||
|
|
||||||
flexversion_res = run_command([flex, '--version'])
|
get_flex_version = find_program('get_flex_version.py')
|
||||||
if flexversion_res.returncode() != 0
|
flexversion_res = run_command([get_flex_version, flex], check: true)
|
||||||
error('Could not get flex version (@0@)'.format(flexversion_res.stderr()))
|
flexversion = flexversion_res.stdout().strip()
|
||||||
endif
|
|
||||||
|
|
||||||
flexversion = flexversion_res.stdout().split('\n')[0].split(' ')[-1].strip()
|
|
||||||
if flexversion.version_compare('<' + flex_min_version)
|
if flexversion.version_compare('<' + flex_min_version)
|
||||||
error('flex version @0@ >= @1@: NO'.format(flexversion, flex_min_version))
|
error('flex version @0@ >= @1@: NO'.format(flexversion, flex_min_version))
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue