From: Zac Medico Date: Fri, 21 Jul 2006 08:41:13 +0000 (-0000) Subject: Move dep_transform from the portage_dep module to portage_update. X-Git-Tag: v2.1.1~160 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=224bee53a59b0971b23ebde65d7fd7251106deb3;p=portage.git Move dep_transform from the portage_dep module to portage_update. svn path=/main/trunk/; revision=3981 --- diff --git a/pym/portage.py b/pym/portage.py index 84a66d399..5e2e65376 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -55,7 +55,7 @@ try: import getbinpkg import portage_dep from portage_dep import dep_getcpv, dep_getkey, get_operator, \ - dep_transform, isjustname, isspecific, isvalidatom + isjustname, isspecific, isvalidatom # XXX: This needs to get cleaned up. import output @@ -91,8 +91,8 @@ try: from portage_checksum import perform_md5,perform_checksum,prelink_capable import eclass_cache from portage_localization import _ - from portage_update import fixdbentries, grab_updates, parse_updates, \ - update_config_files, update_dbentries + from portage_update import dep_transform, fixdbentries, grab_updates, \ + 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 diff --git a/pym/portage_dep.py b/pym/portage_dep.py index 72c6c4257..619caccb7 100644 --- a/pym/portage_dep.py +++ b/pym/portage_dep.py @@ -259,25 +259,3 @@ def dep_getkey(mydep): return mysplit[0] + "/" + mysplit[1] else: return mydep - -def dep_transform(mydep, oldkey, newkey): - origdep = mydep - if not len(mydep): - return mydep - if mydep[0] == "*": - mydep = mydep[1:] - prefix = "" - postfix = "" - if mydep[-1] == "*": - mydep = mydep[:-1] - postfix = "*" - if mydep[:2] in [">=", "<="]: - prefix = mydep[:2] - mydep = mydep[2:] - elif mydep[:1] in "=<>~!": - prefix = mydep[:1] - mydep = mydep[1:] - if mydep == oldkey: - return prefix + newkey + postfix - else: - return origdep diff --git a/pym/portage_update.py b/pym/portage_update.py index 40f05f795..ff09048b1 100644 --- a/pym/portage_update.py +++ b/pym/portage_update.py @@ -7,7 +7,7 @@ import errno, os, re, sys from portage_util import ConfigProtect, grabfile, new_protect_filename, \ normalize_path, write_atomic, writemsg from portage_exception import DirectoryNotFound, PortageException -from portage_dep import dep_getkey, dep_transform, isvalidatom, isjustname +from portage_dep import dep_getkey, isvalidatom, isjustname from portage_const import USER_CONFIG_PATH, WORLD_FILE ignored_dbentries = ("CONTENTS", "environment.bz2") @@ -196,3 +196,25 @@ def update_config_files(config_root, protect, protect_mask, update_iter): writemsg("!!! An error occured while updating a config file:" + \ " '%s'\n" % updating_file, noiselevel=-1) continue + +def dep_transform(mydep, oldkey, newkey): + origdep = mydep + if not len(mydep): + return mydep + if mydep[0] == "*": + mydep = mydep[1:] + prefix = "" + postfix = "" + if mydep[-1] == "*": + mydep = mydep[:-1] + postfix = "*" + if mydep[:2] in [">=", "<="]: + prefix = mydep[:2] + mydep = mydep[2:] + elif mydep[:1] in "=<>~!": + prefix = mydep[:1] + mydep = mydep[1:] + if mydep == oldkey: + return prefix + newkey + postfix + else: + return origdep