diff options
author | Zac Medico <zmedico@gentoo.org> | 2006-07-22 11:19:17 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2006-07-22 11:19:17 +0000 |
commit | 7f3d09bb72b4dba98b7d08f7a11239d786c4fd0e (patch) | |
tree | 9d2b27f538ab157ebd6bea1de5ca91685c1cc9e6 | |
parent | 8a03ce3fcf133302a944e7c8bc2f34c7ef9829cf (diff) | |
download | portage-7f3d09bb72b4dba98b7d08f7a11239d786c4fd0e.tar.gz portage-7f3d09bb72b4dba98b7d08f7a11239d786c4fd0e.tar.bz2 portage-7f3d09bb72b4dba98b7d08f7a11239d786c4fd0e.zip |
Move portage.best() to portage_versions.
svn path=/main/trunk/; revision=3990
-rw-r--r-- | pym/portage.py | 19 | ||||
-rw-r--r-- | pym/portage_versions.py | 14 |
2 files changed, 16 insertions, 17 deletions
diff --git a/pym/portage.py b/pym/portage.py index fd9c9d5a2..ab52fda42 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -95,7 +95,8 @@ try: parse_updates, update_config_files, update_dbentries # Need these functions directly in portage namespace to not break every external tool in existence - from portage_versions import ververify,vercmp,catsplit,catpkgsplit,pkgsplit,pkgcmp + from portage_versions import best, catpkgsplit, catsplit, pkgcmp, \ + pkgsplit, vercmp, ververify # endversion and endversion_keys are for backward compatibility only. from portage_versions import endversion_keys @@ -3632,22 +3633,6 @@ class packagetree: populated=1 pass -def best(mymatches): - "accepts None arguments; assumes matches are valid." - global bestcount - if mymatches is None: - return "" - if not len(mymatches): - return "" - bestmatch=mymatches[0] - p2=catpkgsplit(bestmatch)[1:] - for x in mymatches[1:]: - p1=catpkgsplit(x)[1:] - if pkgcmp(p1,p2)>0: - bestmatch=x - p2=catpkgsplit(bestmatch)[1:] - return bestmatch - def match_to_list(mypkg,mylist): """(pkgname,list) Searches list for entries that matches the package. diff --git a/pym/portage_versions.py b/pym/portage_versions.py index 7c5717987..7492d606e 100644 --- a/pym/portage_versions.py +++ b/pym/portage_versions.py @@ -243,3 +243,17 @@ def catpkgsplit(mydata,silent=1): def catsplit(mydep): return mydep.split("/", 1) +def best(mymatches): + """Accepts None arguments; assumes matches are valid.""" + if mymatches is None: + return "" + if not len(mymatches): + return "" + bestmatch = mymatches[0] + p2 = catpkgsplit(bestmatch)[1:] + for x in mymatches[1:]: + p1 = catpkgsplit(x)[1:] + if pkgcmp(p1, p2) > 0: + bestmatch = x + p2 = catpkgsplit(bestmatch)[1:] + return bestmatch |