Gentoo Archives: gentoo-commits

From: "Zac Medico (zmedico)" <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r15263 - in main/branches/2.1.7: bin pym/portage
Date: Fri, 29 Jan 2010 18:52:18
Message-Id: E1Navwq-0007cv-R8@stork.gentoo.org
1 Author: zmedico
2 Date: 2010-01-29 18:52:04 +0000 (Fri, 29 Jan 2010)
3 New Revision: 15263
4
5 Modified:
6 main/branches/2.1.7/bin/portageq
7 main/branches/2.1.7/pym/portage/__init__.py
8 main/branches/2.1.7/pym/portage/dep.py
9 Log:
10 Add an Atom.evaluate_conditionals() method and use where appropriate.
11 (trunk r15212)
12
13 Modified: main/branches/2.1.7/bin/portageq
14 ===================================================================
15 --- main/branches/2.1.7/bin/portageq 2010-01-29 18:51:56 UTC (rev 15262)
16 +++ main/branches/2.1.7/bin/portageq 2010-01-29 18:52:04 UTC (rev 15263)
17 @@ -49,11 +49,7 @@
18 def eval_atom_use(atom):
19 if atom.use.conditional and 'USE' in os.environ:
20 use = os.environ['USE'].split()
21 - evaluated_atom = portage.dep.remove_slot(atom)
22 - if atom.slot:
23 - evaluated_atom += ":%s" % atom.slot
24 - evaluated_atom += str(atom.use.evaluate_conditionals(use))
25 - atom = portage.dep.Atom(evaluated_atom)
26 + atom = atom.evaluate_conditionals(use)
27 return atom
28
29 #-----------------------------------------------------------------------------
30
31 Modified: main/branches/2.1.7/pym/portage/__init__.py
32 ===================================================================
33 --- main/branches/2.1.7/pym/portage/__init__.py 2010-01-29 18:51:56 UTC (rev 15262)
34 +++ main/branches/2.1.7/pym/portage/__init__.py 2010-01-29 18:52:04 UTC (rev 15263)
35 @@ -7812,11 +7812,7 @@
36 if not repoman and \
37 myuse is not None and isinstance(x, portage.dep.Atom) and x.use:
38 if x.use.conditional:
39 - evaluated_atom = portage.dep.remove_slot(x)
40 - if x.slot:
41 - evaluated_atom += ":%s" % x.slot
42 - evaluated_atom += str(x.use.evaluate_conditionals(myuse))
43 - x = portage.dep.Atom(evaluated_atom)
44 + x = x.evaluate_conditionals(myuse)
45
46 mykey = x.cp
47 if not mykey.startswith("virtual/"):
48
49 Modified: main/branches/2.1.7/pym/portage/dep.py
50 ===================================================================
51 --- main/branches/2.1.7/pym/portage/dep.py 2010-01-29 18:51:56 UTC (rev 15262)
52 +++ main/branches/2.1.7/pym/portage/dep.py 2010-01-29 18:52:04 UTC (rev 15263)
53 @@ -612,6 +612,22 @@
54
55 return False
56
57 + def evaluate_conditionals(self, use):
58 + """
59 + Create an atom instance with any USE conditionals evaluated.
60 + @param use: The set of enabled USE flags
61 + @type other: set
62 + @rtype: Atom
63 + @return: an atom instance with any USE conditionals evaluated
64 + """
65 + if not self.use.conditional:
66 + return self
67 + atom = remove_slot(self)
68 + if self.slot:
69 + atom += ":%s" % self.slot
70 + atom += str(self.use.evaluate_conditionals(use))
71 + return Atom(atom)
72 +
73 def __copy__(self):
74 """Immutable, so returns self."""
75 return self