From a340c26aa6c4af777f94511bb15fe774836edb0b Mon Sep 17 00:00:00 2001 From: Sebastien Luttringer Date: Thu, 8 Dec 2011 17:06:16 +0100 Subject: [PATCH] charachers avec [~-+] in version can be more than ascii --- README | 2 +- installsystems/tools.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README b/README index 759d617..5bc67f1 100644 --- a/README +++ b/README @@ -6,7 +6,7 @@ __________________________ A valid version is an integer without dot. A version n, may be followed by a ~, to indicate it's inferior to n A version n, may be followed by a +, to indicate it's superior to n -Any following ascii chars after ~ or + are ignored +Any following chars after ~ or + are ignored Examples: 1 < 2 diff --git a/installsystems/tools.py b/installsystems/tools.py index 2269f97..713dd35 100644 --- a/installsystems/tools.py +++ b/installsystems/tools.py @@ -478,9 +478,9 @@ def compare_versions(v1, v2): if type(version) is int or type(version) is float: return float(version) elif isinstance(version, basestring): - iv = re.match("^(\d+)(?:([-~+])\w*)?$", version) + iv = re.match("^(\d+)(?:([-~+]).*)?$", version) if iv is None: - raise TypeError('Invalid version: %s' % version) + raise TypeError('Invalid version format: %s' % version) rv = float(iv.group(1)) if iv.group(2) == "~": rv -= 0.1 @@ -488,7 +488,7 @@ def compare_versions(v1, v2): rv += 0.1 return rv else: - raise TypeError('Invalid version: %s' % version) + raise TypeError('Invalid version format: %s' % version) fv1 = get_ver(v1) fv2 = get_ver(v2) -- GitLab