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