From 90a5908947db58d3fbafd7e1e44e3d56815526f6 Mon Sep 17 00:00:00 2001 From: Alec Warner Date: Fri, 12 Jan 2007 03:38:36 +0000 Subject: Change vercmp to use int() instead of string atoi, catch ValueError in pkgcmp svn path=/main/trunk/; revision=5581 --- pym/portage_dep.py | 4 +--- pym/portage_versions.py | 6 +++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/pym/portage_dep.py b/pym/portage_dep.py index 56c923886..271c5ef04 100644 --- a/pym/portage_dep.py +++ b/pym/portage_dep.py @@ -618,9 +618,7 @@ def match_from_list(mydep, candidate_list): for x in candidate_list: try: result = pkgcmp(pkgsplit(x), mysplit) - except SystemExit: - raise - except: + except ValueError: writemsg("\nInvalid package name: %s\n" % x, noiselevel=-1) raise if result is None: diff --git a/pym/portage_versions.py b/pym/portage_versions.py index b80e3739e..1a9fdd054 100644 --- a/pym/portage_versions.py +++ b/pym/portage_versions.py @@ -75,9 +75,9 @@ def vercmp(ver1, ver2, silent=1): # building lists of the version parts before the suffix # first part is simple - list1 = [string.atoi(match1.group(2))] - list2 = [string.atoi(match2.group(2))] - + list1 = [int(match1.group(2))] + list2 = [int(match2.group(2))] + # this part would greatly benefit from a fixed-length version pattern if len(match1.group(3)) or len(match2.group(3)): vlist1 = match1.group(3)[1:].split(".") -- cgit v1.2.3-1-g7c22