1 |
commit: 9590cb4bf4140e3fc5610b1ea0e290b2df93c24a |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue May 24 07:36:34 2016 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue May 31 13:44:08 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=9590cb4b |
7 |
|
8 |
Remove unneeded native_kwargs wrapper |
9 |
|
10 |
Remove the native_kwargs wrapper and all uses of it. As pointed out by |
11 |
Zac Medico, this was only needed for Python < 2.6.5, and we no longer |
12 |
support those versions for quite some time. |
13 |
|
14 |
Acked-by: Alexander Berntsen <bernalex <AT> gentoo.org> |
15 |
|
16 |
bin/portageq | 2 +- |
17 |
pym/_emerge/MiscFunctionsProcess.py | 3 +-- |
18 |
pym/_emerge/actions.py | 2 +- |
19 |
pym/_emerge/depgraph.py | 12 ++++-------- |
20 |
pym/_emerge/resolver/output.py | 3 +-- |
21 |
pym/portage/__init__.py | 9 --------- |
22 |
pym/portage/dbapi/porttree.py | 4 ++-- |
23 |
pym/portage/dbapi/vartree.py | 3 +-- |
24 |
pym/portage/news.py | 3 +-- |
25 |
pym/portage/package/ebuild/doebuild.py | 6 +++--- |
26 |
pym/portage/repository/config.py | 2 +- |
27 |
pym/portage/sync/modules/cvs/cvs.py | 4 ++-- |
28 |
pym/portage/sync/modules/git/git.py | 4 ++-- |
29 |
pym/portage/sync/modules/rsync/rsync.py | 4 ++-- |
30 |
pym/portage/sync/modules/svn/svn.py | 6 +++--- |
31 |
pym/portage/sync/modules/webrsync/webrsync.py | 2 +- |
32 |
pym/portage/util/__init__.py | 2 +- |
33 |
pym/portage/util/configparser.py | 5 ++--- |
34 |
repoman/pym/repoman/modules/scan/ebuild/checks.py | 2 +- |
35 |
19 files changed, 30 insertions(+), 48 deletions(-) |
36 |
|
37 |
diff --git a/bin/portageq b/bin/portageq |
38 |
index 832d004..d645635 100755 |
39 |
--- a/bin/portageq |
40 |
+++ b/bin/portageq |
41 |
@@ -1281,7 +1281,7 @@ def add_pquery_arguments(parser): |
42 |
kwargs["help"] = opt_info["help"] |
43 |
except KeyError: |
44 |
pass |
45 |
- arg_group.add_argument(*pargs, **portage._native_kwargs(kwargs)) |
46 |
+ arg_group.add_argument(*pargs, **kwargs) |
47 |
|
48 |
|
49 |
def usage(argv): |
50 |
|
51 |
diff --git a/pym/_emerge/MiscFunctionsProcess.py b/pym/_emerge/MiscFunctionsProcess.py |
52 |
index b7f5892..99cf598 100644 |
53 |
--- a/pym/_emerge/MiscFunctionsProcess.py |
54 |
+++ b/pym/_emerge/MiscFunctionsProcess.py |
55 |
@@ -40,8 +40,7 @@ class MiscFunctionsProcess(AbstractEbuildProcess): |
56 |
# think this is a real phase. |
57 |
phase_backup = self.settings.pop("EBUILD_PHASE", None) |
58 |
try: |
59 |
- return spawn(" ".join(args), self.settings, |
60 |
- **portage._native_kwargs(kwargs)) |
61 |
+ return spawn(" ".join(args), self.settings, **kwargs) |
62 |
finally: |
63 |
if phase_backup is not None: |
64 |
self.settings["EBUILD_PHASE"] = phase_backup |
65 |
|
66 |
diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py |
67 |
index 59626ad..2ca7902 100644 |
68 |
--- a/pym/_emerge/actions.py |
69 |
+++ b/pym/_emerge/actions.py |
70 |
@@ -2378,7 +2378,7 @@ def load_emerge_config(emerge_config=None, **kargs): |
71 |
if v and v.strip(): |
72 |
kwargs[k] = v |
73 |
emerge_config.trees = portage.create_trees(trees=emerge_config.trees, |
74 |
- **portage._native_kwargs(kwargs)) |
75 |
+ **kwargs) |
76 |
|
77 |
for root_trees in emerge_config.trees.values(): |
78 |
settings = root_trees["vartree"].settings |
79 |
|
80 |
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py |
81 |
index cfaafa3..f78f08d 100644 |
82 |
--- a/pym/_emerge/depgraph.py |
83 |
+++ b/pym/_emerge/depgraph.py |
84 |
@@ -4175,8 +4175,7 @@ class depgraph(object): |
85 |
pargs, kwargs = item |
86 |
kwargs = kwargs.copy() |
87 |
kwargs['collect_use_changes'] = True |
88 |
- if not self._show_unsatisfied_dep(*pargs, |
89 |
- **portage._native_kwargs(kwargs)): |
90 |
+ if not self._show_unsatisfied_dep(*pargs, **kwargs): |
91 |
remaining_items.append(item) |
92 |
if len(remaining_items) != len(self._dynamic_config._unsatisfied_deps_for_display): |
93 |
self._dynamic_config._unsatisfied_deps_for_display = remaining_items |
94 |
@@ -4327,8 +4326,7 @@ class depgraph(object): |
95 |
not been scheduled for replacement. |
96 |
""" |
97 |
kwargs["trees"] = self._dynamic_config._graph_trees |
98 |
- return self._select_atoms_highest_available(*pargs, |
99 |
- **portage._native_kwargs(kwargs)) |
100 |
+ return self._select_atoms_highest_available(*pargs, **kwargs) |
101 |
|
102 |
def _select_atoms_highest_available(self, root, depstring, |
103 |
myuse=None, parent=None, strict=True, trees=None, priority=None): |
104 |
@@ -8511,8 +8509,7 @@ class depgraph(object): |
105 |
writemsg("\n", noiselevel=-1) |
106 |
|
107 |
for pargs, kwargs in self._dynamic_config._unsatisfied_deps_for_display: |
108 |
- self._show_unsatisfied_dep(*pargs, |
109 |
- **portage._native_kwargs(kwargs)) |
110 |
+ self._show_unsatisfied_dep(*pargs, **kwargs) |
111 |
|
112 |
if self._dynamic_config._buildpkgonly_deps_unsatisfied: |
113 |
self._show_merge_list() |
114 |
@@ -8879,8 +8876,7 @@ class depgraph(object): |
115 |
try: |
116 |
for pargs, kwargs in self._dynamic_config._unsatisfied_deps_for_display: |
117 |
self._show_unsatisfied_dep( |
118 |
- *pargs, check_autounmask_breakage=True, |
119 |
- **portage._native_kwargs(kwargs)) |
120 |
+ *pargs, check_autounmask_breakage=True, **kwargs) |
121 |
except self._autounmask_breakage: |
122 |
return True |
123 |
return False |
124 |
|
125 |
diff --git a/pym/_emerge/resolver/output.py b/pym/_emerge/resolver/output.py |
126 |
index ac979f6..e993ce1 100644 |
127 |
--- a/pym/_emerge/resolver/output.py |
128 |
+++ b/pym/_emerge/resolver/output.py |
129 |
@@ -310,8 +310,7 @@ class Display(object): |
130 |
kwargs["myrepo"] = pkg.repo |
131 |
myfilesdict = None |
132 |
try: |
133 |
- myfilesdict = db.getfetchsizes(pkg.cpv, |
134 |
- **portage._native_kwargs(kwargs)) |
135 |
+ myfilesdict = db.getfetchsizes(pkg.cpv, **kwargs) |
136 |
except InvalidDependString as e: |
137 |
# FIXME: validate SRC_URI earlier |
138 |
depstr, = db.aux_get(pkg.cpv, |
139 |
|
140 |
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py |
141 |
index 1c85042..0612e22 100644 |
142 |
--- a/pym/portage/__init__.py |
143 |
+++ b/pym/portage/__init__.py |
144 |
@@ -211,15 +211,6 @@ else: |
145 |
|
146 |
_native_string = _unicode_encode |
147 |
|
148 |
-if sys.hexversion >= 0x20605f0: |
149 |
- def _native_kwargs(kwargs): |
150 |
- return kwargs |
151 |
-else: |
152 |
- # Avoid "TypeError: keywords must be strings" issue triggered |
153 |
- # by unicode_literals: http://bugs.python.org/issue4978 |
154 |
- def _native_kwargs(kwargs): |
155 |
- return dict((_native_string(k), v) for k, v in kwargs.iteritems()) |
156 |
- |
157 |
class _unicode_func_wrapper(object): |
158 |
""" |
159 |
Wraps a function, converts arguments from unicode to bytes, |
160 |
|
161 |
diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py |
162 |
index 1f4374e..a3254d0 100644 |
163 |
--- a/pym/portage/dbapi/porttree.py |
164 |
+++ b/pym/portage/dbapi/porttree.py |
165 |
@@ -213,10 +213,10 @@ class portdbapi(dbapi): |
166 |
# portage group. |
167 |
depcachedir_unshared = True |
168 |
else: |
169 |
- cache_kwargs.update(portage._native_kwargs({ |
170 |
+ cache_kwargs.update({ |
171 |
'gid' : portage_gid, |
172 |
'perms' : 0o664 |
173 |
- })) |
174 |
+ }) |
175 |
|
176 |
# If secpass < 1, we don't want to write to the cache |
177 |
# since then we won't be able to apply group permissions |
178 |
|
179 |
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py |
180 |
index 6209a86..bfbe356 100644 |
181 |
--- a/pym/portage/dbapi/vartree.py |
182 |
+++ b/pym/portage/dbapi/vartree.py |
183 |
@@ -5181,8 +5181,7 @@ class dblink(object): |
184 |
else: |
185 |
kwargs['mode'] = 'w' |
186 |
kwargs['encoding'] = _encodings['repo.content'] |
187 |
- write_atomic(os.path.join(self.dbdir, fname), data, |
188 |
- **portage._native_kwargs(kwargs)) |
189 |
+ write_atomic(os.path.join(self.dbdir, fname), data, **kwargs) |
190 |
|
191 |
def getelements(self,ename): |
192 |
if not os.path.exists(self.dbdir+"/"+ename): |
193 |
|
194 |
diff --git a/pym/portage/news.py b/pym/portage/news.py |
195 |
index ea1b947..177f9db 100644 |
196 |
--- a/pym/portage/news.py |
197 |
+++ b/pym/portage/news.py |
198 |
@@ -246,8 +246,7 @@ class NewsItem(object): |
199 |
for values in self.restrictions.values(): |
200 |
any_match = False |
201 |
for restriction in values: |
202 |
- if restriction.checkRestriction( |
203 |
- **portage._native_kwargs(kwargs)): |
204 |
+ if restriction.checkRestriction(**kwargs): |
205 |
any_match = True |
206 |
if not any_match: |
207 |
all_match = False |
208 |
|
209 |
diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py |
210 |
index d926e03..26e6123 100644 |
211 |
--- a/pym/portage/package/ebuild/doebuild.py |
212 |
+++ b/pym/portage/package/ebuild/doebuild.py |
213 |
@@ -166,7 +166,7 @@ def _doebuild_spawn(phase, settings, actionmap=None, **kwargs): |
214 |
|
215 |
settings['EBUILD_PHASE'] = phase |
216 |
try: |
217 |
- return spawn(cmd, settings, **portage._native_kwargs(kwargs)) |
218 |
+ return spawn(cmd, settings, **kwargs) |
219 |
finally: |
220 |
settings.pop('EBUILD_PHASE', None) |
221 |
|
222 |
@@ -1633,14 +1633,14 @@ def spawn(mystring, mysettings, debug=False, free=False, droppriv=False, |
223 |
try: |
224 |
if keywords.get("returnpid"): |
225 |
return spawn_func(mystring, env=mysettings.environ(), |
226 |
- **portage._native_kwargs(keywords)) |
227 |
+ **keywords) |
228 |
|
229 |
proc = EbuildSpawnProcess( |
230 |
background=False, args=mystring, |
231 |
scheduler=SchedulerInterface(portage._internal_caller and |
232 |
global_event_loop() or EventLoop(main=False)), |
233 |
spawn_func=spawn_func, |
234 |
- settings=mysettings, **portage._native_kwargs(keywords)) |
235 |
+ settings=mysettings, **keywords) |
236 |
|
237 |
proc.start() |
238 |
proc.wait() |
239 |
|
240 |
diff --git a/pym/portage/repository/config.py b/pym/portage/repository/config.py |
241 |
index a23f4bd..0512057 100644 |
242 |
--- a/pym/portage/repository/config.py |
243 |
+++ b/pym/portage/repository/config.py |
244 |
@@ -329,7 +329,7 @@ class RepoConfig(object): |
245 |
if self.disable_manifest: |
246 |
kwds['from_scratch'] = True |
247 |
kwds['find_invalid_path_char'] = self.find_invalid_path_char |
248 |
- return manifest.Manifest(*args, **portage._native_kwargs(kwds)) |
249 |
+ return manifest.Manifest(*args, **kwds) |
250 |
|
251 |
def update(self, new_repo): |
252 |
"""Update repository with options in another RepoConfig""" |
253 |
|
254 |
diff --git a/pym/portage/sync/modules/cvs/cvs.py b/pym/portage/sync/modules/cvs/cvs.py |
255 |
index 7b7908b..e202560 100644 |
256 |
--- a/pym/portage/sync/modules/cvs/cvs.py |
257 |
+++ b/pym/portage/sync/modules/cvs/cvs.py |
258 |
@@ -38,7 +38,7 @@ class CVSSync(NewBase): |
259 |
(portage._shell_quote(os.path.dirname(self.repo.location)), portage._shell_quote(cvs_root), |
260 |
portage._shell_quote(os.path.basename(self.repo.location)), |
261 |
portage._shell_quote(self.repo.module_specific_options["sync-cvs-repo"])), |
262 |
- **portage._native_kwargs(self.spawn_kwargs)) != os.EX_OK: |
263 |
+ **self.spawn_kwargs) != os.EX_OK: |
264 |
msg = "!!! cvs checkout error; exiting." |
265 |
self.logger(self.xterm_titles, msg) |
266 |
writemsg_level(msg + "\n", noiselevel=-1, level=logging.ERROR) |
267 |
@@ -59,7 +59,7 @@ class CVSSync(NewBase): |
268 |
exitcode = portage.process.spawn_bash( |
269 |
"cd %s; exec cvs -z0 -q update -dP" % \ |
270 |
(portage._shell_quote(self.repo.location),), |
271 |
- **portage._native_kwargs(self.spawn_kwargs)) |
272 |
+ **self.spawn_kwargs) |
273 |
if exitcode != os.EX_OK: |
274 |
msg = "!!! cvs update error; exiting." |
275 |
self.logger(self.xterm_titles, msg) |
276 |
|
277 |
diff --git a/pym/portage/sync/modules/git/git.py b/pym/portage/sync/modules/git/git.py |
278 |
index e6724f6..02eeb16 100644 |
279 |
--- a/pym/portage/sync/modules/git/git.py |
280 |
+++ b/pym/portage/sync/modules/git/git.py |
281 |
@@ -62,7 +62,7 @@ class GitSync(NewBase): |
282 |
|
283 |
exitcode = portage.process.spawn_bash("cd %s ; exec %s" % ( |
284 |
portage._shell_quote(self.repo.location), git_cmd), |
285 |
- **portage._native_kwargs(self.spawn_kwargs)) |
286 |
+ **self.spawn_kwargs) |
287 |
if exitcode != os.EX_OK: |
288 |
msg = "!!! git clone error in %s" % self.repo.location |
289 |
self.logger(self.xterm_titles, msg) |
290 |
@@ -92,7 +92,7 @@ class GitSync(NewBase): |
291 |
|
292 |
exitcode = portage.process.spawn_bash("cd %s ; exec %s" % ( |
293 |
portage._shell_quote(self.repo.location), git_cmd), |
294 |
- **portage._native_kwargs(self.spawn_kwargs)) |
295 |
+ **self.spawn_kwargs) |
296 |
if exitcode != os.EX_OK: |
297 |
msg = "!!! git pull error in %s" % self.repo.location |
298 |
self.logger(self.xterm_titles, msg) |
299 |
|
300 |
diff --git a/pym/portage/sync/modules/rsync/rsync.py b/pym/portage/sync/modules/rsync/rsync.py |
301 |
index e0f76b3..cf95835 100644 |
302 |
--- a/pym/portage/sync/modules/rsync/rsync.py |
303 |
+++ b/pym/portage/sync/modules/rsync/rsync.py |
304 |
@@ -438,7 +438,7 @@ class RsyncSync(NewBase): |
305 |
|
306 |
pids.extend(portage.process.spawn( |
307 |
command, returnpid=True, |
308 |
- **portage._native_kwargs(self.spawn_kwargs))) |
309 |
+ **self.spawn_kwargs)) |
310 |
exitcode = os.waitpid(pids[0], 0)[1] |
311 |
if self.usersync_uid is not None: |
312 |
portage.util.apply_permissions(tmpservertimestampfile, |
313 |
@@ -522,7 +522,7 @@ class RsyncSync(NewBase): |
314 |
exitcode = None |
315 |
try: |
316 |
exitcode = portage.process.spawn(command, |
317 |
- **portage._native_kwargs(self.spawn_kwargs)) |
318 |
+ **self.spawn_kwargs) |
319 |
finally: |
320 |
if exitcode is None: |
321 |
# interrupted |
322 |
|
323 |
diff --git a/pym/portage/sync/modules/svn/svn.py b/pym/portage/sync/modules/svn/svn.py |
324 |
index da38e6f..723beed 100644 |
325 |
--- a/pym/portage/sync/modules/svn/svn.py |
326 |
+++ b/pym/portage/sync/modules/svn/svn.py |
327 |
@@ -37,7 +37,7 @@ class SVNSync(NewBase): |
328 |
"cd %s; exec svn co %s ." % |
329 |
(portage._shell_quote(self.repo.location), |
330 |
portage._shell_quote(svn_root)), |
331 |
- **portage._native_kwargs(self.spawn_kwargs)) |
332 |
+ **self.spawn_kwargs) |
333 |
if exitcode != os.EX_OK: |
334 |
msg = "!!! svn checkout error; exiting." |
335 |
self.logger(self.xterm_titles, msg) |
336 |
@@ -62,7 +62,7 @@ class SVNSync(NewBase): |
337 |
exitcode = portage.process.spawn_bash( |
338 |
"cd %s; exec svn update" % \ |
339 |
(portage._shell_quote(self.repo.location),), |
340 |
- **portage._native_kwargs(self.spawn_kwargs)) |
341 |
+ **self.spawn_kwargs) |
342 |
if exitcode != os.EX_OK: |
343 |
msg = "!!! svn update error; exiting." |
344 |
self.logger(self.xterm_titles, msg) |
345 |
@@ -81,7 +81,7 @@ class SVNSync(NewBase): |
346 |
exitcode = portage.process.spawn_bash( |
347 |
"cd %s; exec svn upgrade" % |
348 |
(portage._shell_quote(self.repo.location),), |
349 |
- **portage._native_kwargs(self.spawn_kwargs)) |
350 |
+ **self.spawn_kwargs) |
351 |
if exitcode != os.EX_OK: |
352 |
msg = "!!! svn upgrade error; exiting." |
353 |
self.logger(self.xterm_titles, msg) |
354 |
|
355 |
diff --git a/pym/portage/sync/modules/webrsync/webrsync.py b/pym/portage/sync/modules/webrsync/webrsync.py |
356 |
index 92208b5..3d79f45 100644 |
357 |
--- a/pym/portage/sync/modules/webrsync/webrsync.py |
358 |
+++ b/pym/portage/sync/modules/webrsync/webrsync.py |
359 |
@@ -41,7 +41,7 @@ class WebRsync(SyncBase): |
360 |
|
361 |
exitcode = portage.process.spawn_bash("%s" % \ |
362 |
(self.bin_command), |
363 |
- **portage._native_kwargs(self.spawn_kwargs)) |
364 |
+ **self.spawn_kwargs) |
365 |
if exitcode != os.EX_OK: |
366 |
msg = "!!! emerge-webrsync error in %s" % self.repo.location |
367 |
self.logger(self.xterm_titles, msg) |
368 |
|
369 |
diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py |
370 |
index 417fb98..c6d6a84 100644 |
371 |
--- a/pym/portage/util/__init__.py |
372 |
+++ b/pym/portage/util/__init__.py |
373 |
@@ -1285,7 +1285,7 @@ class atomic_ofstream(ObjectProxy): |
374 |
object.__setattr__(self, '_file', |
375 |
open_func(_unicode_encode(tmp_name, |
376 |
encoding=_encodings['fs'], errors='strict'), |
377 |
- mode=mode, **portage._native_kwargs(kargs))) |
378 |
+ mode=mode, **kargs)) |
379 |
return |
380 |
except IOError as e: |
381 |
if canonical_path == filename: |
382 |
|
383 |
diff --git a/pym/portage/util/configparser.py b/pym/portage/util/configparser.py |
384 |
index fb1a351..c4c92a6 100644 |
385 |
--- a/pym/portage/util/configparser.py |
386 |
+++ b/pym/portage/util/configparser.py |
387 |
@@ -23,7 +23,6 @@ except ImportError: |
388 |
NoOptionError, ParsingError, RawConfigParser, SafeConfigParser) |
389 |
|
390 |
from portage import _encodings |
391 |
-from portage import _native_kwargs |
392 |
from portage import _unicode_encode |
393 |
|
394 |
|
395 |
@@ -66,12 +65,12 @@ def read_configs(parser, paths): |
396 |
# because it assumes that f.name is a native string rather |
397 |
# than binary when constructing error messages. |
398 |
kwargs = {source_kwarg: p} |
399 |
- read_file(f, **_native_kwargs(kwargs)) |
400 |
+ read_file(f, **kwargs) |
401 |
finally: |
402 |
if f is not None: |
403 |
f.close() |
404 |
elif isinstance(p, io.StringIO): |
405 |
kwargs = {source_kwarg: "<io.StringIO>"} |
406 |
- read_file(p, **_native_kwargs(kwargs)) |
407 |
+ read_file(p, **kwargs) |
408 |
else: |
409 |
raise TypeError("Unsupported type %r of element %r of 'paths' argument" % (type(p), p)) |
410 |
|
411 |
diff --git a/repoman/pym/repoman/modules/scan/ebuild/checks.py b/repoman/pym/repoman/modules/scan/ebuild/checks.py |
412 |
index fb3e019..15e2251 100644 |
413 |
--- a/repoman/pym/repoman/modules/scan/ebuild/checks.py |
414 |
+++ b/repoman/pym/repoman/modules/scan/ebuild/checks.py |
415 |
@@ -917,7 +917,7 @@ def checks_init(experimental_inherit=False): |
416 |
isinstance(v, type) |
417 |
and issubclass(v, LineCheck) |
418 |
and v not in _base_check_classes)), ( |
419 |
- InheritEclass(k, **portage._native_kwargs(kwargs)) |
420 |
+ InheritEclass(k, **kwargs) |
421 |
for k, kwargs in _eclass_info.items()))) |