From: Zac Medico Date: Sat, 24 May 2008 22:03:27 +0000 (-0000) Subject: For dep_expand() backward compatibility, handle atoms with missing '=' X-Git-Tag: v2.2_pre8~120 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=535c83185b1f6990044b02cb9bdafb39a4bc2d3d;p=portage.git For dep_expand() backward compatibility, handle atoms with missing '=' prefix which did not raise an error here before the portage.dep.Atom class was introduced. svn path=/main/trunk/; revision=10394 --- diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index a42f99894..dfe7ddeb0 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -5720,8 +5720,15 @@ def dep_expand(mydep, mydb=None, use_cache=1, settings=None): myindex = orig_dep.index(mydep) prefix = orig_dep[:myindex] postfix = orig_dep[myindex+len(mydep):] - return portage.dep.Atom(prefix + cpv_expand( - mydep, mydb=mydb, use_cache=use_cache, settings=settings) + postfix) + expanded = cpv_expand(mydep, mydb=mydb, + use_cache=use_cache, settings=settings) + try: + return portage.dep.Atom(prefix + expanded + postfix) + except portage.exception.InvalidAtom: + # Missing '=' prefix is allowed for backward compatibility. + if not isvalidatom("=" + prefix + expanded + postfix): + raise + return portage.dep.Atom("=" + prefix + expanded + postfix) def dep_check(depstring, mydbapi, mysettings, use="yes", mode=None, myuse=None, use_cache=1, use_binaries=0, myroot="/", trees=None):