Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 264434 | Differences between
and this patch

Collapse All | Expand All

(-)pym/portage/dep.py (+31 lines)
Lines 339-345 Link Here
339
			retlist.append(deplist[x])
339
			retlist.append(deplist[x])
340
		x += 1
340
		x += 1
341
	return retlist
341
	return retlist
342
	
343
def dep_restructure(deplist):
344
	"""
345
	Iterate recursively through a list of deps, if the
346
	dep is a '||' or 'useflag?' operator, combine it with the
347
	list of deps that follows.
342
348
349
	Example usage:
350
		>>> test = ["blah", "||", ["foo", "bar"], "useflag?", ["baz"] ]
351
		>>> dep_opconvert(test)
352
		['blah', ['||', ['foo', 'bar', 'baz'] ], [ "useflag?", ["baz"] ] ]
353
354
	@param deplist: A list of deps to format
355
	@type mydep: List
356
	@rtype: List
357
	@return:
358
		The new list with the new ordering
359
	"""
360
361
	retlist = []
362
	x = 0
363
	while x != len(deplist):
364
		if isinstance(deplist[x], list):
365
			retlist.append(dep_restructure(deplist[x]))
366
		elif deplist[x] == "||" or deplist[x][-1] == "?":
367
			retlist.append([deplist[x]] + [ dep_restructure(deplist[x+1]) ] )
368
			x += 1
369
		else:
370
			retlist.append(deplist[x])
371
		x += 1
372
	return retlist
373
343
class _use_dep(object):
374
class _use_dep(object):
344
375
345
	__slots__ = ("__weakref__", "conditional",
376
	__slots__ = ("__weakref__", "conditional",
(-)pym/_emerge/__init__.py (-18 / +60 lines)
Lines 4752-4757 Link Here
4752
		self._unsatisfied_blockers_for_display = None
4752
		self._unsatisfied_blockers_for_display = None
4753
		self._circular_deps_for_display = None
4753
		self._circular_deps_for_display = None
4754
		self._dep_stack = []
4754
		self._dep_stack = []
4755
		self._deps = []
4755
		self._unsatisfied_deps = []
4756
		self._unsatisfied_deps = []
4756
		self._initially_unsatisfied_deps = []
4757
		self._initially_unsatisfied_deps = []
4757
		self._ignored_deps = []
4758
		self._ignored_deps = []
Lines 5033-5047 Link Here
5033
5034
5034
	def _create_graph(self, allow_unsatisfied=False):
5035
	def _create_graph(self, allow_unsatisfied=False):
5035
		dep_stack = self._dep_stack
5036
		dep_stack = self._dep_stack
5036
		while dep_stack:
5037
		deps = self._deps
5037
			self.spinner.update()
5038
		while dep_stack or deps:
5038
			dep = dep_stack.pop()
5039
			while dep_stack:
5039
			if isinstance(dep, Package):
5040
				self.spinner.update()
5040
				if not self._add_pkg_deps(dep,
5041
				dep = dep_stack.pop()
5041
					allow_unsatisfied=allow_unsatisfied):
5042
				if isinstance(dep, Package):
5043
					if not self._add_pkg_deps(dep,
5044
						allow_unsatisfied=allow_unsatisfied):
5045
						return 0
5046
					continue
5047
				if not self._add_dep(dep, allow_unsatisfied=allow_unsatisfied):
5042
					return 0
5048
					return 0
5043
				continue
5049
			if not self._process_deps(allow_unsatisfied):
5044
			if not self._add_dep(dep, allow_unsatisfied=allow_unsatisfied):
5045
				return 0
5050
				return 0
5046
		return 1
5051
		return 1
5047
5052
Lines 5341-5360 Link Here
5341
			elif root_deps == "rdeps":
5346
			elif root_deps == "rdeps":
5342
				edepend["DEPEND"] = ""
5347
				edepend["DEPEND"] = ""
5343
5348
5344
		deps = (
5349
		for dep_type in ["DEPEND", "RDEPEND", "PDEPEND"]:
5345
			(bdeps_root, edepend["DEPEND"],
5350
			dep_string = edepend[dep_type]
5346
				self._priority(buildtime=(not bdeps_optional),
5351
			if not dep_string:
5347
				optional=bdeps_optional)),
5352
				continue
5348
			(myroot, edepend["RDEPEND"], self._priority(runtime=True)),
5353
			
5349
			(myroot, edepend["PDEPEND"], self._priority(runtime_post=True))
5354
			try:
5350
		)
5355
				dep_string = portage.dep.paren_reduce(dep_string)
5356
			except portage.exception.InvalidDependString, e:				
5357
				return 0
5351
5358
5359
			dep_string = portage.dep.dep_restructure(dep_string)
5360
			
5361
			for dep in dep_string:
5362
				self._deps.append((pkg, bdeps_root, dep,
5363
					self._priority(buildtime=(not bdeps_optional),
5364
					optional=bdeps_optional)))
5365
5366
		return 1
5367
		
5368
	def _is_or_dep(self, dep):
5369
		if isinstance(dep,list):
5370
			for d in dep:
5371
				if self._is_or_dep(d):
5372
					return 1
5373
		else:
5374
			return dep.find("||") != -1
5375
		
5376
		return 0
5377
5378
	def _process_deps(self, allow_unsatisfied=False):
5352
		debug = "--debug" in self.myopts
5379
		debug = "--debug" in self.myopts
5353
		strict = mytype != "installed"
5380
		deps = self._deps
5354
		try:
5381
		try:
5355
			for dep_root, dep_string, dep_priority in deps:
5382
			while deps:
5383
				is_or_dep = self._is_or_dep(deps[-1][2])
5384
5385
				if is_or_dep and self._dep_stack:
5386
					#don't process or-deps if we don't have to
5387
					return 1
5388
				pkg, dep_root, dep_string, dep_priority = deps.pop()
5356
				if not dep_string:
5389
				if not dep_string:
5357
					continue
5390
					continue
5391
				mytype = pkg.type_name
5392
				myuse = pkg.use.enabled
5393
				jbigkey = pkg
5394
				depth = pkg.depth + 1
5395
				strict = mytype != "installed"
5358
				if debug:
5396
				if debug:
5359
					print
5397
					print
5360
					print "Parent:   ", jbigkey
5398
					print "Parent:   ", jbigkey
Lines 5362-5369 Link Here
5362
					print "Priority:", dep_priority
5400
					print "Priority:", dep_priority
5363
				vardb = self.roots[dep_root].trees["vartree"].dbapi
5401
				vardb = self.roots[dep_root].trees["vartree"].dbapi
5364
				try:
5402
				try:
5403
					if isinstance(dep_string,list):
5404
						new_dep_string = portage.dep.paren_enclose(dep_string)
5405
					else:
5406
						new_dep_string = dep_string
5365
					selected_atoms = self._select_atoms(dep_root,
5407
					selected_atoms = self._select_atoms(dep_root,
5366
						dep_string, myuse=myuse, parent=pkg, strict=strict,
5408
						new_dep_string, myuse=myuse, parent=pkg, strict=strict,
5367
						priority=dep_priority)
5409
						priority=dep_priority)
5368
				except portage.exception.InvalidDependString, e:
5410
				except portage.exception.InvalidDependString, e:
5369
					show_invalid_depstring_notice(jbigkey, dep_string, str(e))
5411
					show_invalid_depstring_notice(jbigkey, dep_string, str(e))

Return to bug 264434