1 |
* This fixes the referenced warning by renaming the 'id' variable to |
2 |
'name' and the 'type' variable to 'atype' |
3 |
* Additional cosmetic/style changes found along the way. |
4 |
|
5 |
Signed-off-by: Aaron Bauman <bman@g.o> |
6 |
--- |
7 |
lib/_emerge/resolver/slot_collision.py | 74 +++++++++++++------------- |
8 |
1 file changed, 37 insertions(+), 37 deletions(-) |
9 |
|
10 |
diff --git a/lib/_emerge/resolver/slot_collision.py b/lib/_emerge/resolver/slot_collision.py |
11 |
index cc16287de..b29d68f2a 100644 |
12 |
--- a/lib/_emerge/resolver/slot_collision.py |
13 |
+++ b/lib/_emerge/resolver/slot_collision.py |
14 |
@@ -591,14 +591,14 @@ class slot_conflict_handler: |
15 |
version_violated = False |
16 |
slot_violated = False |
17 |
use = [] |
18 |
- for (type, sub_type), parents in collision_reasons.items(): |
19 |
+ for (atype, sub_type), parents in collision_reasons.items(): |
20 |
for x in parents: |
21 |
if parent == x[0] and atom == x[1]: |
22 |
- if type == "version": |
23 |
+ if atype == "version": |
24 |
version_violated = True |
25 |
- elif type == "slot": |
26 |
+ elif atype == "slot": |
27 |
slot_violated = True |
28 |
- elif type == "use": |
29 |
+ elif atype == "use": |
30 |
use.append(sub_type) |
31 |
break |
32 |
|
33 |
@@ -934,64 +934,64 @@ class slot_conflict_handler: |
34 |
msg += "}" |
35 |
msg += "]\n" |
36 |
writemsg(msg, noiselevel=-1) |
37 |
- |
38 |
+ |
39 |
required_changes = {} |
40 |
- for id, pkg in enumerate(config): |
41 |
+ for name, pkg in enumerate(config): |
42 |
if not pkg.installed: |
43 |
- #We can't change the USE of installed packages. |
44 |
- for flag in all_involved_flags[id]: |
45 |
+ # We can't change the USE of installed packages. |
46 |
+ for flag in all_involved_flags[name]: |
47 |
if not pkg.iuse.is_valid_flag(flag): |
48 |
continue |
49 |
- state = all_involved_flags[id][flag] |
50 |
+ state = all_involved_flags[name][flag] |
51 |
self._force_flag_for_package(required_changes, pkg, flag, state) |
52 |
|
53 |
- #Go through all (parent, atom) pairs for the current slot conflict. |
54 |
- for ppkg, atom in all_conflict_atoms_by_slotatom[id]: |
55 |
+ # Go through all (parent, atom) pairs for the current slot conflict. |
56 |
+ for ppkg, atom in all_conflict_atoms_by_slotatom[name]: |
57 |
if not atom.package: |
58 |
continue |
59 |
use = atom.unevaluated_atom.use |
60 |
if not use: |
61 |
- #No need to force something for an atom without USE conditionals. |
62 |
- #These atoms are already satisfied. |
63 |
+ # No need to force something for an atom without USE conditionals. |
64 |
+ # These atoms are already satisfied. |
65 |
continue |
66 |
- for flag in all_involved_flags[id]: |
67 |
- state = all_involved_flags[id][flag] |
68 |
+ for flag in all_involved_flags[name]: |
69 |
+ state = all_involved_flags[name][flag] |
70 |
|
71 |
if flag not in use.required or not use.conditional: |
72 |
continue |
73 |
if flag in use.conditional.enabled: |
74 |
- #[flag?] |
75 |
+ # [flag?] |
76 |
if state == "enabled": |
77 |
- #no need to change anything, the atom won't |
78 |
- #force -flag on pkg |
79 |
+ # no need to change anything, the atom won't |
80 |
+ # force -flag on pkg |
81 |
pass |
82 |
elif state == "disabled": |
83 |
- #if flag is enabled we get [flag] -> it must be disabled |
84 |
+ # if flag is enabled we get [flag] -> it must be disabled |
85 |
self._force_flag_for_package(required_changes, ppkg, flag, "disabled") |
86 |
elif flag in use.conditional.disabled: |
87 |
- #[!flag?] |
88 |
+ # [!flag?] |
89 |
if state == "enabled": |
90 |
- #if flag is enabled we get [-flag] -> it must be disabled |
91 |
+ # if flag is enabled we get [-flag] -> it must be disabled |
92 |
self._force_flag_for_package(required_changes, ppkg, flag, "disabled") |
93 |
elif state == "disabled": |
94 |
- #no need to change anything, the atom won't |
95 |
- #force +flag on pkg |
96 |
+ # no need to change anything, the atom won't |
97 |
+ # force +flag on pkg |
98 |
pass |
99 |
elif flag in use.conditional.equal: |
100 |
- #[flag=] |
101 |
+ # [flag=] |
102 |
if state == "enabled": |
103 |
- #if flag is disabled we get [-flag] -> it must be enabled |
104 |
+ # if flag is disabled we get [-flag] -> it must be enabled |
105 |
self._force_flag_for_package(required_changes, ppkg, flag, "enabled") |
106 |
elif state == "disabled": |
107 |
- #if flag is enabled we get [flag] -> it must be disabled |
108 |
+ # if flag is enabled we get [flag] -> it must be disabled |
109 |
self._force_flag_for_package(required_changes, ppkg, flag, "disabled") |
110 |
elif flag in use.conditional.not_equal: |
111 |
- #[!flag=] |
112 |
+ # [!flag=] |
113 |
if state == "enabled": |
114 |
- #if flag is enabled we get [-flag] -> it must be disabled |
115 |
+ # if flag is enabled we get [-flag] -> it must be disabled |
116 |
self._force_flag_for_package(required_changes, ppkg, flag, "disabled") |
117 |
elif state == "disabled": |
118 |
- #if flag is disabled we get [flag] -> it must be enabled |
119 |
+ # if flag is disabled we get [flag] -> it must be enabled |
120 |
self._force_flag_for_package(required_changes, ppkg, flag, "enabled") |
121 |
|
122 |
is_valid_solution = True |
123 |
@@ -999,12 +999,12 @@ class slot_conflict_handler: |
124 |
for state in required_changes[pkg].values(): |
125 |
if not state in ("enabled", "disabled"): |
126 |
is_valid_solution = False |
127 |
- |
128 |
+ |
129 |
if not is_valid_solution: |
130 |
return None |
131 |
|
132 |
- #Check if all atoms are satisfied after the changes are applied. |
133 |
- for id, pkg in enumerate(config): |
134 |
+ # Check if all atoms are satisfied after the changes are applied. |
135 |
+ for name, pkg in enumerate(config): |
136 |
new_use = _pkg_use_enabled(pkg) |
137 |
if pkg in required_changes: |
138 |
old_use = pkg.use.enabled |
139 |
@@ -1015,14 +1015,14 @@ class slot_conflict_handler: |
140 |
elif state == "disabled": |
141 |
new_use.discard(flag) |
142 |
if not new_use.symmetric_difference(old_use): |
143 |
- #avoid copying the package in findAtomForPackage if possible |
144 |
+ # avoid copying the package in findAtomForPackage if possible |
145 |
new_use = old_use |
146 |
|
147 |
- for ppkg, atom in all_conflict_atoms_by_slotatom[id]: |
148 |
+ for ppkg, atom in all_conflict_atoms_by_slotatom[name]: |
149 |
if not atom.package: |
150 |
continue |
151 |
if not hasattr(ppkg, "use"): |
152 |
- #It's a SetArg or something like that. |
153 |
+ # It's a SetArg or something like that. |
154 |
continue |
155 |
ppkg_new_use = set(_pkg_use_enabled(ppkg)) |
156 |
if ppkg in required_changes: |
157 |
@@ -1035,7 +1035,7 @@ class slot_conflict_handler: |
158 |
new_atom = atom.unevaluated_atom.evaluate_conditionals(ppkg_new_use) |
159 |
i = InternalPackageSet(initial_atoms=(new_atom,)) |
160 |
if not i.findAtomForPackage(pkg, new_use): |
161 |
- #We managed to create a new problem with our changes. |
162 |
+ # We managed to create a new problem with our changes. |
163 |
is_valid_solution = False |
164 |
if self.debug: |
165 |
writemsg(("new conflict introduced: %s" |
166 |
@@ -1046,7 +1046,7 @@ class slot_conflict_handler: |
167 |
if not is_valid_solution: |
168 |
break |
169 |
|
170 |
- #Make sure the changes don't violate REQUIRED_USE |
171 |
+ # Make sure the changes don't violate REQUIRED_USE |
172 |
for pkg in required_changes: |
173 |
required_use = pkg._metadata.get("REQUIRED_USE") |
174 |
if not required_use: |
175 |
-- |
176 |
2.28.0 |