except ValueError:
badsyntax.append("parenthesis mismatch")
mydeplist = []
+ except portage_exception.InvalidDependString, e:
+ badsyntax.append(str(e))
+ del e
+ mydeplist = []
try:
portage_dep.use_reduce(mydeplist, excludeall=myiuse)
if not eapi_is_supported(eapi):
# can't do anything with this.
raise portage_exception.UnsupportedAPIException(mycpv, eapi)
- mysettings["PORTAGE_RESTRICT"] = " ".join(flatten(
- portage_dep.use_reduce(portage_dep.paren_reduce(
- mysettings["RESTRICT"]), uselist=mysettings["USE"].split())))
+ try:
+ mysettings["PORTAGE_RESTRICT"] = " ".join(flatten(
+ portage_dep.use_reduce(portage_dep.paren_reduce(
+ mysettings.get("RESTRICT","")),
+ uselist=mysettings.get("USE","").split())))
+ except portage_exception.InvalidDependString:
+ # RESTRICT is validated again inside doebuild, so let this go
+ mysettings["PORTAGE_RESTRICT"] = ""
if mysplit[2] == "r0":
mysettings["PVR"]=mysplit[1]
myusesplit=[]
#convert parenthesis to sublists
- mysplit = portage_dep.paren_reduce(depstring)
+ try:
+ mysplit = portage_dep.paren_reduce(depstring)
+ except portage_exception.InvalidDependString, e:
+ return [0, str(e)]
mymasks = set()
useforce = set()
"""
mylist = []
while mystr:
- if ("(" not in mystr) and (")" not in mystr):
+ left_paren = mystr.find("(")
+ has_left_paren = left_paren != -1
+ right_paren = mystr.find(")")
+ has_right_paren = right_paren != -1
+ if not has_left_paren and not has_right_paren:
freesec = mystr
subsec = None
tail = ""
elif mystr[0] == ")":
return [mylist,mystr[1:]]
- elif ("(" in mystr) and (mystr.index("(") < mystr.index(")")):
+ elif has_left_paren and not has_right_paren:
+ raise portage_exception.InvalidDependString(
+ "missing right parenthesis: '%s'" % mystr)
+ elif has_left_paren and left_paren < right_paren:
freesec,subsec = mystr.split("(",1)
subsec,tail = paren_reduce(subsec,tokenize)
else: