check_dependencies.py fails on version numbers with letters (bug #1095699)

bzr-revno: 2128
Fixes: https://launchpad.net/bugs/1095699
This commit is contained in:
Arjan Schrijver 2013-01-15 22:03:37 +01:00 committed by Andreas Preikschat
commit 6abfdc4215

View File

@ -38,6 +38,7 @@ modules, simply run this script::
"""
import os
import sys
from distutils.version import LooseVersion
is_win = sys.platform.startswith('win')
@ -89,15 +90,13 @@ OPTIONAL_MODULES = [
w = sys.stdout.write
def check_vers(version, required, text):
if type(version) is str:
version = version.split('.')
version = map(int, version)
if type(required) is str:
required = required.split('.')
required = map(int, required)
w(' %s >= %s ... ' % (text, '.'.join(map(str, required))))
if version >= required:
w('.'.join(map(str, version)) + os.linesep)
if type(version) is not str:
version = '.'.join(map(str, version))
if type(required) is not str:
required = '.'.join(map(str, required))
w(' %s >= %s ... ' % (text, required))
if LooseVersion(version) >= LooseVersion(required):
w(version + os.linesep)
return True
else:
w('FAIL' + os.linesep)