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