summaryrefslogtreecommitdiffstats
path: root/pym/portage
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-04-19 05:44:22 +0000
committerZac Medico <zmedico@gentoo.org>2009-04-19 05:44:22 +0000
commit8dbcc983b98ecc78a4396ae98c4219ed5128d5ae (patch)
tree331f76d8f515ceb71ff5504e7f156b32b06b57a4 /pym/portage
parent5ebcc3927e39b4531c8633d7d8c0a377e7e174b1 (diff)
downloadportage-8dbcc983b98ecc78a4396ae98c4219ed5128d5ae.tar.gz
portage-8dbcc983b98ecc78a4396ae98c4219ed5128d5ae.tar.bz2
portage-8dbcc983b98ecc78a4396ae98c4219ed5128d5ae.zip
Add a new --deselect action which removes atoms from the world file. This
action is implied by uninstall actions, including --depclean, --prune and --unmerge. Use --deselect=n in order to prevent uninstall actions from removing atoms from the world file. This solves bug #259994 and bug #265206. svn path=/main/trunk/; revision=13363
Diffstat (limited to 'pym/portage')
-rw-r--r--pym/portage/dep.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/pym/portage/dep.py b/pym/portage/dep.py
index 866258715..80ebdadbc 100644
--- a/pym/portage/dep.py
+++ b/pym/portage/dep.py
@@ -558,6 +558,36 @@ class Atom(object):
raise AttributeError("Atom instances are immutable",
self.__class__, name, value)
+ def intersects(self, other):
+ """
+ Atoms with different operator or cpv attributes cause this method to
+ return False. TODO: Detect intersection when operators are present.
+ @param other: The package atom to match
+ @type other: Atom
+ @rtype: Boolean
+ @return: True if this atom and the other atom intersect,
+ False otherwise.
+ """
+ if not isinstance(other, Atom):
+ raise TypeError("expected %s, got %s" % \
+ (Atom, type(other)))
+
+ if self == other:
+ return True
+
+ if self.cp != other.cp or \
+ self.use != other.use or \
+ self.operator != other.operator or \
+ self.cpv != other.cpv:
+ return False
+
+ if self.slot is None or \
+ other.slot is None or \
+ self.slot == other.slot:
+ return True
+
+ return False
+
# Implement some common str methods.
def __eq__(self, other):