scons: move to regex for more robust libtool version detection
This commit is contained in:
parent
1114172e3e
commit
f7784fd6a7
1 changed files with 14 additions and 6 deletions
20
SConstruct
20
SConstruct
|
@ -63,14 +63,22 @@ def call(cmd, silent=False):
|
||||||
|
|
||||||
def get_libtool_version():
|
def get_libtool_version():
|
||||||
cmd = 'libtool'
|
cmd = 'libtool'
|
||||||
version = 2
|
|
||||||
if platform.uname()[0] == "Darwin":
|
if platform.uname()[0] == "Darwin":
|
||||||
cmd = 'glibtool'
|
cmd = 'glibtool'
|
||||||
ret = os.popen('%s --version' % cmd).readlines()
|
version = 2
|
||||||
if len(ret):
|
pattern = r'(.*)(\d/.\d/.\d)(.*)'
|
||||||
version_string = ret[0].strip().split(' ')[-1]
|
ret = os.popen('%s --version' % cmd).read()
|
||||||
if version_string:
|
match = re.match(pattern,ret)
|
||||||
version = version_string.split('.')[0]
|
if match:
|
||||||
|
groups = match.groups()
|
||||||
|
if len(groups):
|
||||||
|
version_string = groups[1]
|
||||||
|
if version_string:
|
||||||
|
version = version_string.split('.')[0]
|
||||||
|
try:
|
||||||
|
version = int(version)
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
return version
|
return version
|
||||||
|
|
||||||
# http://www.scons.org/wiki/InstallTargets
|
# http://www.scons.org/wiki/InstallTargets
|
||||||
|
|
Loading…
Reference in a new issue