Mercurial > gub
changeset 245:55e12963bc63
bugfix for version check skip, use full_version ().
author | janneke <janneke@gnu.org> |
---|---|
date | Thu, 15 Dec 2005 16:00:49 +0100 |
parents | 2aa50412cca8 |
children | ea3286ba11e1 |
files | driver.py specs/cpm.py specs/gub.py |
diffstat | 3 files changed, 11 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/driver.py Thu Dec 15 13:58:36 2005 +0100 +++ b/driver.py Thu Dec 15 16:00:49 2005 +0100 @@ -137,7 +137,7 @@ """ return p.system_gpm.is_installed (p.name()) \ and p.system_gpm.version (p.name ()) \ - == cpm.string_to_version (p.ball_version) + == cpm.string_to_version (p.full_version ()) if not settings.offline: for i in packages:
--- a/specs/cpm.py Thu Dec 15 13:58:36 2005 +0100 +++ b/specs/cpm.py Thu Dec 15 16:00:49 2005 +0100 @@ -45,20 +45,21 @@ try_run_script ('%s/%s' % (dir, i)) def version_to_string (t): - def try_itoa (x): + def itoa (x): if type (x) == int: return "%d" % x return x - return '%s-%s' % (string.join (map (try_itoa, t[:-1]), '.'), t[-1]) + return '%s-%s' % (string.join (map (itoa, t[:-1]), '.'), t[-1]) def string_to_version (s): s = re.sub ('([^0-9][^0-9]*)', ' \\1 ', s) s = re.sub ('[ _.-][ _.-]*', ' ', s) - def try_atoi (x): - if re.match ('^[0-9]*$', x): + s = s.strip () + def atoi (x): + if re.match ('^[0-9]+$', x): return string.atoi (x) return x - return tuple (map (try_atoi, (string.split (s, ' ')))) + return tuple (map (atoi, (string.split (s, ' ')))) def split_version (s): m = re.match ('^(([0-9].*)-([0-9]+))$', s)
--- a/specs/gub.py Thu Dec 15 13:58:36 2005 +0100 +++ b/specs/gub.py Thu Dec 15 16:00:49 2005 +0100 @@ -6,6 +6,7 @@ import os import re +import string import subprocess import sys import time @@ -213,6 +214,9 @@ s = re.sub ('-[0-9][^-]+(-[0-9]+)?$', '', s) return s + def full_version (self): + return string.join ([self.version (), self.build ()], '-') + def version (self): return cpm.split_version (self.ball_version)[0]