1 |
commit: 8202118e14d08edd394656aa450d8e5343d13943 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Jul 28 15:47:31 2011 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Jul 28 15:47:31 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=8202118e |
7 |
|
8 |
Support PMAtom.blocking. |
9 |
|
10 |
--- |
11 |
gentoopm/basepm/atom.py | 13 +++++++++++++ |
12 |
gentoopm/basepm/pkg.py | 4 ++++ |
13 |
gentoopm/paludispm/atom.py | 4 ++++ |
14 |
gentoopm/pkgcorepm/atom.py | 5 +++++ |
15 |
gentoopm/portagepm/atom.py | 4 ++++ |
16 |
5 files changed, 30 insertions(+), 0 deletions(-) |
17 |
|
18 |
diff --git a/gentoopm/basepm/atom.py b/gentoopm/basepm/atom.py |
19 |
index 9fa2c39..e745a38 100644 |
20 |
--- a/gentoopm/basepm/atom.py |
21 |
+++ b/gentoopm/basepm/atom.py |
22 |
@@ -153,6 +153,19 @@ class PMAtom(ABCObject, StringifiedComparisons): |
23 |
""" |
24 |
pass |
25 |
|
26 |
+ @abstractproperty |
27 |
+ def blocking(self): |
28 |
+ """ |
29 |
+ Whether the atom represents a blocking atom. |
30 |
+ |
31 |
+ Support for block atoms is limited. They may not be parseable from user |
32 |
+ input (using L{PackageManager.Atom()}), and they should not be used as |
33 |
+ arguments to matching functions. |
34 |
+ |
35 |
+ @type: bool |
36 |
+ """ |
37 |
+ pass |
38 |
+ |
39 |
@property |
40 |
def associated(self): |
41 |
""" |
42 |
|
43 |
diff --git a/gentoopm/basepm/pkg.py b/gentoopm/basepm/pkg.py |
44 |
index 6b191fa..33a4435 100644 |
45 |
--- a/gentoopm/basepm/pkg.py |
46 |
+++ b/gentoopm/basepm/pkg.py |
47 |
@@ -357,6 +357,10 @@ class PMPackage(PMAtom, FillMissingComparisons): |
48 |
return True |
49 |
|
50 |
@property |
51 |
+ def blocking(self): |
52 |
+ return False |
53 |
+ |
54 |
+ @property |
55 |
def associated(self): |
56 |
return True |
57 |
|
58 |
|
59 |
diff --git a/gentoopm/paludispm/atom.py b/gentoopm/paludispm/atom.py |
60 |
index ea1d233..ec5b830 100644 |
61 |
--- a/gentoopm/paludispm/atom.py |
62 |
+++ b/gentoopm/paludispm/atom.py |
63 |
@@ -122,6 +122,10 @@ class PaludisAtom(PMAtom): |
64 |
return not self._incomplete |
65 |
|
66 |
@property |
67 |
+ def blocking(self): |
68 |
+ return bool(self._blocking) |
69 |
+ |
70 |
+ @property |
71 |
def key(self): |
72 |
if self.complete: |
73 |
return PaludisPackageKey(self._atom.package) |
74 |
|
75 |
diff --git a/gentoopm/pkgcorepm/atom.py b/gentoopm/pkgcorepm/atom.py |
76 |
index 698864e..ac0a350 100644 |
77 |
--- a/gentoopm/pkgcorepm/atom.py |
78 |
+++ b/gentoopm/pkgcorepm/atom.py |
79 |
@@ -117,6 +117,11 @@ class PkgCoreAtom(PMAtom): |
80 |
return isinstance(self._r, atom) |
81 |
|
82 |
@property |
83 |
+ def blocking(self): |
84 |
+ # incomplete atoms can't block |
85 |
+ return self.complete and self._r.blocks |
86 |
+ |
87 |
+ @property |
88 |
def key(self): |
89 |
if self.complete: |
90 |
return PkgCorePackageKey(self._r) |
91 |
|
92 |
diff --git a/gentoopm/portagepm/atom.py b/gentoopm/portagepm/atom.py |
93 |
index 28b273d..425fd1e 100644 |
94 |
--- a/gentoopm/portagepm/atom.py |
95 |
+++ b/gentoopm/portagepm/atom.py |
96 |
@@ -93,6 +93,10 @@ class CompletePortageAtom(PMAtom): |
97 |
return True |
98 |
|
99 |
@property |
100 |
+ def blocking(self): |
101 |
+ return self._atom.blocker |
102 |
+ |
103 |
+ @property |
104 |
def key(self): |
105 |
return PortagePackageKey(self._atom.cp) |