1 |
Author: grobian |
2 |
Date: 2009-08-24 09:27:07 +0000 (Mon, 24 Aug 2009) |
3 |
New Revision: 14137 |
4 |
|
5 |
Modified: |
6 |
main/branches/prefix/bin/isolated-functions.sh |
7 |
main/branches/prefix/pym/portage/__init__.py |
8 |
main/branches/prefix/pym/portage/_selinux.py |
9 |
main/branches/prefix/pym/portage/checksum.py |
10 |
main/branches/prefix/pym/portage/data.py |
11 |
main/branches/prefix/pym/portage/dbapi/vartree.py |
12 |
main/branches/prefix/pym/portage/dep.py |
13 |
main/branches/prefix/pym/portage/dispatch_conf.py |
14 |
main/branches/prefix/pym/portage/exception.py |
15 |
main/branches/prefix/pym/portage/getbinpkg.py |
16 |
main/branches/prefix/pym/portage/glsa.py |
17 |
main/branches/prefix/pym/portage/locks.py |
18 |
main/branches/prefix/pym/portage/mail.py |
19 |
main/branches/prefix/pym/portage/manifest.py |
20 |
main/branches/prefix/pym/portage/news.py |
21 |
main/branches/prefix/pym/portage/output.py |
22 |
main/branches/prefix/pym/portage/process.py |
23 |
main/branches/prefix/pym/portage/update.py |
24 |
main/branches/prefix/pym/portage/util.py |
25 |
main/branches/prefix/pym/portage/versions.py |
26 |
Log: |
27 |
Merged from trunk -r14057:14067 |
28 |
|
29 |
| 14058 | Fix dblink._unmerge_pkgfiles() to use the correct version | |
30 |
| zmedico | of perform_md5 when it falls back to utf8 encoding. | |
31 |
|
32 |
| 14059 | In perform_checksum(), encode the filename with correct | |
33 |
| zmedico | encoding before passing to spawn (for prelink), and enable | |
34 |
| | strict encoding behavior in _perform_md5_merge(). | |
35 |
|
36 |
| 14060 | Make _generate_hash_function() use _fs_encoding to encode | |
37 |
| zmedico | the filename (if it's not already encoded), and enable | |
38 |
| | errors='strict'. | |
39 |
|
40 |
| 14061 | Make movefile() use process.spawn() instead of | |
41 |
| zmedico | getstatusoutput() when calling MOVE_BINARY, since spawn | |
42 |
| | will pass encoded file paths directly as arguments. | |
43 |
|
44 |
| 14062 | Update import to import portage.os (with unicode wrappers), | |
45 |
| zmedico | and use _unicode_encode() and _content_encoding for | |
46 |
| | encoding unicode env vars in spawn(). | |
47 |
|
48 |
| 14063 | Remove ACCEPT_PROPERTIES variable generation code which | |
49 |
| zmedico | isn't needed since, unlike ACCEPT_LICENSE, | |
50 |
| | ACCEPT_PROPERTIES isn't passed into the ebuild environment. | |
51 |
|
52 |
| 14064 | Fix typo. | |
53 |
| zmedico | | |
54 |
|
55 |
| 14065 | Remove ACCEPT_PROPERTIES filtering since it's filtered on | |
56 |
| zmedico | the python side. | |
57 |
|
58 |
| 14067 | Prepare 308 messages to localization. | |
59 |
| arfrever | | |
60 |
|
61 |
|
62 |
Modified: main/branches/prefix/bin/isolated-functions.sh |
63 |
=================================================================== |
64 |
--- main/branches/prefix/bin/isolated-functions.sh 2009-08-24 09:20:57 UTC (rev 14136) |
65 |
+++ main/branches/prefix/bin/isolated-functions.sh 2009-08-24 09:27:07 UTC (rev 14137) |
66 |
@@ -540,7 +540,7 @@ |
67 |
${QA_INTERCEPTORS} |
68 |
|
69 |
# portage config variables and variables set directly by portage |
70 |
- unset ACCEPT_LICENSE ACCEPT_PROPERTIES BAD BRACKET BUILD_PREFIX COLS \ |
71 |
+ unset ACCEPT_LICENSE BAD BRACKET BUILD_PREFIX COLS \ |
72 |
DISTCC_DIR DISTDIR DOC_SYMLINKS_DIR \ |
73 |
EBUILD_EXIT_STATUS_FILE EBUILD_FORCE_TEST EBUILD_MASTER_PID \ |
74 |
ECLASSDIR ECLASS_DEPTH ENDCOL FAKEROOTKEY \ |
75 |
|
76 |
Modified: main/branches/prefix/pym/portage/__init__.py |
77 |
=================================================================== |
78 |
--- main/branches/prefix/pym/portage/__init__.py 2009-08-24 09:20:57 UTC (rev 14136) |
79 |
+++ main/branches/prefix/pym/portage/__init__.py 2009-08-24 09:27:07 UTC (rev 14137) |
80 |
@@ -1110,14 +1110,14 @@ |
81 |
# an older package installed ON TOP of a newer version will cause ldconfig |
82 |
# to overwrite the symlinks we just made. -X means no links. After 'clean' |
83 |
# we can safely create links. |
84 |
- writemsg_level(">>> Regenerating %s/etc/ld.so.cache...\n" % \ |
85 |
+ writemsg_level(_(">>> Regenerating %setc/ld.so.cache...\n") % \ |
86 |
(target_root + EPREFIX_LSTRIP,)) |
87 |
if makelinks: |
88 |
os.system("cd / ; %s -r '%s'" % (ldconfig, target_root)) |
89 |
else: |
90 |
os.system("cd / ; %s -X -r '%s'" % (ldconfig, target_root)) |
91 |
elif ostype in ("FreeBSD","DragonFly"): |
92 |
- writemsg_level(">>> Regenerating %svar/run/ld-elf.so.hints...\n" % \ |
93 |
+ writemsg_level(_(">>> Regenerating %svar/run/ld-elf.so.hints...\n") % \ |
94 |
target_root + EPREFIX_LSTRIP) |
95 |
os.system(("cd / ; %s -elf -i " + \ |
96 |
"-f '%svar/run/ld-elf.so.hints' '%setc/ld.so.conf'") % \ |
97 |
@@ -1570,7 +1570,7 @@ |
98 |
|
99 |
def check_var_directory(varname, var): |
100 |
if not os.path.isdir(var): |
101 |
- writemsg(("!!! Error: %s='%s' is not a directory. " + \ |
102 |
+ writemsg(_("!!! Error: %s='%s' is not a directory. " |
103 |
"Please correct this.\n") % (varname, var), |
104 |
noiselevel=-1) |
105 |
raise portage.exception.DirectoryNotFound(var) |
106 |
@@ -1640,15 +1640,15 @@ |
107 |
pass |
108 |
else: |
109 |
if not eapi_is_supported(eapi): |
110 |
- raise portage.exception.ParseError( |
111 |
- "Profile contains unsupported " + \ |
112 |
- "EAPI '%s': '%s'" % \ |
113 |
+ raise portage.exception.ParseError(_( |
114 |
+ "Profile contains unsupported " |
115 |
+ "EAPI '%s': '%s'") % \ |
116 |
(eapi, os.path.realpath(eapi_file),)) |
117 |
if os.path.exists(parentsFile): |
118 |
parents = grabfile(parentsFile) |
119 |
if not parents: |
120 |
raise portage.exception.ParseError( |
121 |
- "Empty parent file: '%s'" % parentsFile) |
122 |
+ _("Empty parent file: '%s'") % parentsFile) |
123 |
for parentPath in parents: |
124 |
parentPath = normalize_path(os.path.join( |
125 |
currentPath, parentPath)) |
126 |
@@ -1656,13 +1656,13 @@ |
127 |
addProfile(parentPath) |
128 |
else: |
129 |
raise portage.exception.ParseError( |
130 |
- "Parent '%s' not found: '%s'" % \ |
131 |
+ _("Parent '%s' not found: '%s'") % \ |
132 |
(parentPath, parentsFile)) |
133 |
self.profiles.append(currentPath) |
134 |
try: |
135 |
addProfile(os.path.realpath(self.profile_path)) |
136 |
except portage.exception.ParseError, e: |
137 |
- writemsg("!!! Unable to parse profile: '%s'\n" % \ |
138 |
+ writemsg(_("!!! Unable to parse profile: '%s'\n") % \ |
139 |
self.profile_path, noiselevel=-1) |
140 |
writemsg("!!! ParseError: %s\n" % str(e), noiselevel=-1) |
141 |
del e |
142 |
@@ -1990,7 +1990,7 @@ |
143 |
del e |
144 |
except ParsingError, e: |
145 |
portage.util.writemsg_level( |
146 |
- "!!! Error parsing '%s': %s\n" % \ |
147 |
+ _("!!! Error parsing '%s': %s\n") % \ |
148 |
(self._local_repo_conf_path, e), |
149 |
level=logging.ERROR, noiselevel=-1) |
150 |
del e |
151 |
@@ -2049,26 +2049,26 @@ |
152 |
for x in range(len(pkgprovidedlines)-1, -1, -1): |
153 |
myline = pkgprovidedlines[x] |
154 |
if not isvalidatom("=" + myline): |
155 |
- writemsg("Invalid package name in package.provided:" + \ |
156 |
- " %s\n" % myline, noiselevel=-1) |
157 |
+ writemsg(_("Invalid package name in package.provided: %s\n") % \ |
158 |
+ myline, noiselevel=-1) |
159 |
has_invalid_data = True |
160 |
del pkgprovidedlines[x] |
161 |
continue |
162 |
cpvr = catpkgsplit(pkgprovidedlines[x]) |
163 |
if not cpvr or cpvr[0] == "null": |
164 |
- writemsg("Invalid package name in package.provided: "+pkgprovidedlines[x]+"\n", |
165 |
+ writemsg(_("Invalid package name in package.provided: ")+pkgprovidedlines[x]+"\n", |
166 |
noiselevel=-1) |
167 |
has_invalid_data = True |
168 |
del pkgprovidedlines[x] |
169 |
continue |
170 |
if cpvr[0] == "virtual": |
171 |
- writemsg("Virtual package in package.provided: %s\n" % \ |
172 |
+ writemsg(_("Virtual package in package.provided: %s\n") % \ |
173 |
myline, noiselevel=-1) |
174 |
has_invalid_data = True |
175 |
del pkgprovidedlines[x] |
176 |
continue |
177 |
if has_invalid_data: |
178 |
- writemsg("See portage(5) for correct package.provided usage.\n", |
179 |
+ writemsg(_("See portage(5) for correct package.provided usage.\n"), |
180 |
noiselevel=-1) |
181 |
self.pprovideddict = {} |
182 |
for x in pkgprovidedlines: |
183 |
@@ -2107,8 +2107,8 @@ |
184 |
if os.path.isdir(ov): |
185 |
new_ov.append(ov) |
186 |
else: |
187 |
- writemsg("!!! Invalid PORTDIR_OVERLAY" + \ |
188 |
- " (not a dir): '%s'\n" % ov, noiselevel=-1) |
189 |
+ writemsg(_("!!! Invalid PORTDIR_OVERLAY" |
190 |
+ " (not a dir): '%s'\n") % ov, noiselevel=-1) |
191 |
self["PORTDIR_OVERLAY"] = " ".join(new_ov) |
192 |
self.backup_changes("PORTDIR_OVERLAY") |
193 |
|
194 |
@@ -2125,7 +2125,7 @@ |
195 |
try: |
196 |
self[var] = str(int(self.get(var, "0"))) |
197 |
except ValueError: |
198 |
- writemsg(("!!! %s='%s' is not a valid integer. " + \ |
199 |
+ writemsg(_("!!! %s='%s' is not a valid integer. " |
200 |
"Falling back to '0'.\n") % (var, self[var]), |
201 |
noiselevel=-1) |
202 |
self[var] = "0" |
203 |
@@ -2142,8 +2142,8 @@ |
204 |
""" Don't show this warning when running repoman and the |
205 |
sandbox feature came from a profile that doesn't belong to |
206 |
the user.""" |
207 |
- writemsg(colorize("BAD", "!!! Problem with sandbox" + \ |
208 |
- " binary. Disabling...\n\n"), noiselevel=-1) |
209 |
+ writemsg(colorize("BAD", _("!!! Problem with sandbox" |
210 |
+ " binary. Disabling...\n\n")), noiselevel=-1) |
211 |
if "sandbox" in self.features: |
212 |
self.features.remove("sandbox") |
213 |
if "usersandbox" in self.features: |
214 |
@@ -2196,7 +2196,7 @@ |
215 |
try: |
216 |
portage.util.ensure_dirs(mydir, gid=gid, mode=mode, mask=modemask) |
217 |
except portage.exception.PortageException, e: |
218 |
- writemsg("!!! Directory initialization failed: '%s'\n" % mydir, |
219 |
+ writemsg(_("!!! Directory initialization failed: '%s'\n") % mydir, |
220 |
noiselevel=-1) |
221 |
writemsg("!!! %s\n" % str(e), |
222 |
noiselevel=-1) |
223 |
@@ -2226,20 +2226,20 @@ |
224 |
traversed_groups = set() |
225 |
license_group = self._license_groups.get(group_name) |
226 |
if group_name in traversed_groups: |
227 |
- writemsg(("Circular license group reference" + \ |
228 |
+ writemsg(_("Circular license group reference" |
229 |
" detected in '%s'\n") % group_name, noiselevel=-1) |
230 |
rValue.append("@"+group_name) |
231 |
elif license_group: |
232 |
traversed_groups.add(group_name) |
233 |
for l in license_group: |
234 |
if l.startswith("-"): |
235 |
- writemsg(("Skipping invalid element %s" + \ |
236 |
+ writemsg(_("Skipping invalid element %s" |
237 |
" in license group '%s'\n") % (l, group_name), |
238 |
noiselevel=-1) |
239 |
else: |
240 |
rValue.extend(self._expandLicenseToken(l, traversed_groups)) |
241 |
else: |
242 |
- writemsg("Undefined license group '%s'\n" % group_name, |
243 |
+ writemsg(_("Undefined license group '%s'\n") % group_name, |
244 |
noiselevel=-1) |
245 |
rValue.append("@"+group_name) |
246 |
if negate: |
247 |
@@ -2253,14 +2253,14 @@ |
248 |
groups = self["ACCEPT_KEYWORDS"].split() |
249 |
archlist = self.archlist() |
250 |
if not archlist: |
251 |
- writemsg("--- 'profiles/arch.list' is empty or " + \ |
252 |
- "not available. Empty portage tree?\n", noiselevel=1) |
253 |
+ writemsg(_("--- 'profiles/arch.list' is empty or " |
254 |
+ "not available. Empty portage tree?\n"), noiselevel=1) |
255 |
else: |
256 |
for group in groups: |
257 |
if group not in archlist and \ |
258 |
not (group.startswith("-") and group[1:] in archlist) and \ |
259 |
group not in ("*", "~*", "**"): |
260 |
- writemsg("!!! INVALID ACCEPT_KEYWORDS: %s\n" % str(group), |
261 |
+ writemsg(_("!!! INVALID ACCEPT_KEYWORDS: %s\n") % str(group), |
262 |
noiselevel=-1) |
263 |
|
264 |
abs_profile_path = os.path.join(self["PORTAGE_CONFIGROOT"], |
265 |
@@ -2268,10 +2268,10 @@ |
266 |
if not self.profile_path or (not os.path.islink(abs_profile_path) and \ |
267 |
not os.path.exists(os.path.join(abs_profile_path, "parent")) and \ |
268 |
os.path.exists(os.path.join(self["PORTDIR"], "profiles"))): |
269 |
- writemsg("\a\n\n!!! %s is not a symlink and will probably prevent most merges.\n" % abs_profile_path, |
270 |
+ writemsg(_("\a\n\n!!! %s is not a symlink and will probably prevent most merges.\n") % abs_profile_path, |
271 |
noiselevel=-1) |
272 |
- writemsg("!!! It should point into a profile within %s/profiles/\n" % self["PORTDIR"]) |
273 |
- writemsg("!!! (You can safely ignore this message when syncing. It's harmless.)\n\n\n") |
274 |
+ writemsg(_("!!! It should point into a profile within %s/profiles/\n") % self["PORTDIR"]) |
275 |
+ writemsg(_("!!! (You can safely ignore this message when syncing. It's harmless.)\n\n\n")) |
276 |
|
277 |
abs_user_virtuals = os.path.join(self["PORTAGE_CONFIGROOT"], |
278 |
USER_VIRTUALS_FILE) |
279 |
@@ -2282,8 +2282,8 @@ |
280 |
|
281 |
if "fakeroot" in self.features and \ |
282 |
not portage.process.fakeroot_capable: |
283 |
- writemsg("!!! FEATURES=fakeroot is enabled, but the " + \ |
284 |
- "fakeroot binary is not installed.\n", noiselevel=-1) |
285 |
+ writemsg(_("!!! FEATURES=fakeroot is enabled, but the " |
286 |
+ "fakeroot binary is not installed.\n"), noiselevel=-1) |
287 |
|
288 |
def loadVirtuals(self,root): |
289 |
"""Not currently used by portage.""" |
290 |
@@ -2314,14 +2314,14 @@ |
291 |
|
292 |
def modifying(self): |
293 |
if self.locked: |
294 |
- raise Exception("Configuration is locked.") |
295 |
+ raise Exception(_("Configuration is locked.")) |
296 |
|
297 |
def backup_changes(self,key=None): |
298 |
self.modifying() |
299 |
if key and key in self.configdict["env"]: |
300 |
self.backupenv[key] = copy.deepcopy(self.configdict["env"][key]) |
301 |
else: |
302 |
- raise KeyError("No such key defined in environment: %s" % key) |
303 |
+ raise KeyError(_("No such key defined in environment: %s") % key) |
304 |
|
305 |
def reset(self,keeping_pkg=0,use_cache=1): |
306 |
""" |
307 |
@@ -2376,7 +2376,6 @@ |
308 |
if use is None: |
309 |
use = frozenset(settings['PORTAGE_USE'].split()) |
310 |
values['ACCEPT_LICENSE'] = self._accept_license(use, settings) |
311 |
- values['ACCEPT_PROPERTIES'] = self._accept_properties(use, settings) |
312 |
values['PORTAGE_RESTRICT'] = self._restrict(use, settings) |
313 |
return values |
314 |
|
315 |
@@ -2410,35 +2409,6 @@ |
316 |
licenses = acceptable_licenses |
317 |
return ' '.join(sorted(licenses)) |
318 |
|
319 |
- def _accept_properties(self, use, settings): |
320 |
- """ |
321 |
- Generated a pruned version of ACCEPT_PROPERTIES, by intersection with |
322 |
- PROPERTIES. |
323 |
- Please, look at self._accept_license() to know why it is required. |
324 |
- """ |
325 |
- try: |
326 |
- properties = set(flatten( |
327 |
- dep.use_reduce(dep.paren_reduce( |
328 |
- settings['PROPERTIES']), |
329 |
- uselist=use))) |
330 |
- except exception.InvalidDependString: |
331 |
- properties = set() |
332 |
- properties.discard('||') |
333 |
- if settings._accept_properties: |
334 |
- acceptable_properties = set() |
335 |
- for x in settings._accept_properties: |
336 |
- if x == '*': |
337 |
- acceptable_properties.update(properties) |
338 |
- elif x == '-*': |
339 |
- acceptable_properties.clear() |
340 |
- elif x[1] == '-': |
341 |
- acceptable_properties.discard(x[1:]) |
342 |
- elif x in properties: |
343 |
- acceptable_properties.add(x) |
344 |
- |
345 |
- properties = acceptable_properties |
346 |
- return ' '.join(sorted(properties)) |
347 |
- |
348 |
def _restrict(self, use, settings): |
349 |
try: |
350 |
restrict = set(flatten( |
351 |
@@ -2677,8 +2647,6 @@ |
352 |
lazy_vars = self._lazy_vars(built_use, self) |
353 |
env_configdict.addLazySingleton('ACCEPT_LICENSE', |
354 |
lazy_vars.__getitem__, 'ACCEPT_LICENSE') |
355 |
- env_configdict.addLazySingleton('ACCEPT_PROPERTIES', |
356 |
- lazy_vars.__getitem__, 'ACCEPT_PROPERTIES') |
357 |
env_configdict.addLazySingleton('PORTAGE_RESTRICT', |
358 |
lazy_vars.__getitem__, 'PORTAGE_RESTRICT') |
359 |
|
360 |
@@ -2702,7 +2670,7 @@ |
361 |
if ebuild_force_test and \ |
362 |
not hasattr(self, "_ebuild_force_test_msg_shown"): |
363 |
self._ebuild_force_test_msg_shown = True |
364 |
- writemsg("Forcing test.\n", noiselevel=-1) |
365 |
+ writemsg(_("Forcing test.\n"), noiselevel=-1) |
366 |
if "test" in self.features and "test" in iuse_implicit: |
367 |
if "test" in self.usemask and not ebuild_force_test: |
368 |
# "test" is in IUSE and USE=test is masked, so execution |
369 |
@@ -2965,8 +2933,8 @@ |
370 |
hastesting = False |
371 |
for gp in mygroups: |
372 |
if gp == "*" or (gp == "-*" and len(mygroups) == 1): |
373 |
- writemsg(("--- WARNING: Package '%s' uses" + \ |
374 |
- " '%s' keyword.\n") % (cpv, gp), noiselevel=-1) |
375 |
+ writemsg(_("--- WARNING: Package '%(cpv)s' uses" |
376 |
+ " '%(keyword)s' keyword.\n") % {"cpv": cpv, "keyword": gp}, noiselevel=-1) |
377 |
if gp == "*": |
378 |
match = 1 |
379 |
break |
380 |
@@ -3169,7 +3137,7 @@ |
381 |
try: |
382 |
self._accept_chost_re = re.compile(r'^%s$' % accept_chost[0]) |
383 |
except re.error, e: |
384 |
- writemsg("!!! Invalid ACCEPT_CHOSTS value: '%s': %s\n" % \ |
385 |
+ writemsg(_("!!! Invalid ACCEPT_CHOSTS value: '%s': %s\n") % \ |
386 |
(accept_chost[0], e), noiselevel=-1) |
387 |
self._accept_chost_re = re.compile("^$") |
388 |
else: |
389 |
@@ -3177,7 +3145,7 @@ |
390 |
self._accept_chost_re = re.compile( |
391 |
r'^(%s)$' % "|".join(accept_chost)) |
392 |
except re.error, e: |
393 |
- writemsg("!!! Invalid ACCEPT_CHOSTS value: '%s': %s\n" % \ |
394 |
+ writemsg(_("!!! Invalid ACCEPT_CHOSTS value: '%s': %s\n") % \ |
395 |
(" ".join(accept_chost), e), noiselevel=-1) |
396 |
self._accept_chost_re = re.compile("^$") |
397 |
|
398 |
@@ -3332,7 +3300,7 @@ |
399 |
if x[0]=="+": |
400 |
# Not legal. People assume too much. Complain. |
401 |
writemsg(colorize("BAD", |
402 |
- "USE flags should not start with a '+': %s" % x) \ |
403 |
+ _("USE flags should not start with a '+': %s") % x) \ |
404 |
+ "\n", noiselevel=-1) |
405 |
x=x[1:] |
406 |
if not x: |
407 |
@@ -3391,8 +3359,8 @@ |
408 |
continue |
409 |
|
410 |
if x[0] == "+": |
411 |
- writemsg(colorize("BAD", "USE flags should not start " + \ |
412 |
- "with a '+': %s\n" % x), noiselevel=-1) |
413 |
+ writemsg(colorize("BAD", _("USE flags should not start " |
414 |
+ "with a '+': %s\n") % x), noiselevel=-1) |
415 |
x = x[1:] |
416 |
if not x: |
417 |
continue |
418 |
@@ -3415,20 +3383,20 @@ |
419 |
for x in curdb[var].split(): |
420 |
if x[0] == "+": |
421 |
if is_not_incremental: |
422 |
- writemsg(colorize("BAD", "Invalid '+' " + \ |
423 |
- "operator in non-incremental variable " + \ |
424 |
- "'%s': '%s'\n" % (var, x)), noiselevel=-1) |
425 |
+ writemsg(colorize("BAD", _("Invalid '+' " |
426 |
+ "operator in non-incremental variable " |
427 |
+ "'%s': '%s'\n") % (var, x)), noiselevel=-1) |
428 |
continue |
429 |
else: |
430 |
- writemsg(colorize("BAD", "Invalid '+' " + \ |
431 |
- "operator in incremental variable " + \ |
432 |
- "'%s': '%s'\n" % (var, x)), noiselevel=-1) |
433 |
+ writemsg(colorize("BAD", _("Invalid '+' " |
434 |
+ "operator in incremental variable " |
435 |
+ "'%s': '%s'\n") % (var, x)), noiselevel=-1) |
436 |
x = x[1:] |
437 |
if x[0] == "-": |
438 |
if is_not_incremental: |
439 |
- writemsg(colorize("BAD", "Invalid '-' " + \ |
440 |
- "operator in non-incremental variable " + \ |
441 |
- "'%s': '%s'\n" % (var, x)), noiselevel=-1) |
442 |
+ writemsg(colorize("BAD", _("Invalid '-' " |
443 |
+ "operator in non-incremental variable " |
444 |
+ "'%s': '%s'\n") % (var, x)), noiselevel=-1) |
445 |
continue |
446 |
myflags.discard(var_lower + "_" + x[1:]) |
447 |
continue |
448 |
@@ -3475,7 +3443,7 @@ |
449 |
virtuals_dict = grabdict(virtuals_file) |
450 |
for k in virtuals_dict.keys(): |
451 |
if not isvalidatom(k) or dep_getkey(k) != k: |
452 |
- writemsg("--- Invalid virtuals atom in %s: %s\n" % \ |
453 |
+ writemsg(_("--- Invalid virtuals atom in %s: %s\n") % \ |
454 |
(virtuals_file, k), noiselevel=-1) |
455 |
del virtuals_dict[k] |
456 |
continue |
457 |
@@ -3486,7 +3454,7 @@ |
458 |
# allow incrementals |
459 |
myatom = x[1:] |
460 |
if not isvalidatom(myatom): |
461 |
- writemsg("--- Invalid atom in %s: %s\n" % \ |
462 |
+ writemsg(_("--- Invalid atom in %s: %s\n") % \ |
463 |
(virtuals_file, x), noiselevel=-1) |
464 |
myvalues.remove(x) |
465 |
if not myvalues: |
466 |
@@ -3642,7 +3610,7 @@ |
467 |
continue |
468 |
myvalue = self[x] |
469 |
if not isinstance(myvalue, basestring): |
470 |
- writemsg("!!! Non-string value in config: %s=%s\n" % \ |
471 |
+ writemsg(_("!!! Non-string value in config: %s=%s\n") % \ |
472 |
(x, myvalue), noiselevel=-1) |
473 |
continue |
474 |
if filter_calling_env and \ |
475 |
@@ -3702,7 +3670,7 @@ |
476 |
else: |
477 |
self._selinux_enabled = 0 |
478 |
else: |
479 |
- writemsg("!!! SELinux module not found. Please verify that it was installed.\n", |
480 |
+ writemsg(_("!!! SELinux module not found. Please verify that it was installed.\n"), |
481 |
noiselevel=-1) |
482 |
self._selinux_enabled = 0 |
483 |
|
484 |
@@ -4073,11 +4041,11 @@ |
485 |
verified_ok, reason = portage.checksum.verify_all(filename, digests) |
486 |
if not verified_ok: |
487 |
if show_errors: |
488 |
- writemsg("!!! Previously fetched" + \ |
489 |
- " file: '%s'\n" % filename, noiselevel=-1) |
490 |
- writemsg("!!! Reason: %s\n" % reason[0], |
491 |
+ writemsg(_("!!! Previously fetched" |
492 |
+ " file: '%s'\n") % filename, noiselevel=-1) |
493 |
+ writemsg(_("!!! Reason: %s\n") % reason[0], |
494 |
noiselevel=-1) |
495 |
- writemsg(("!!! Got: %s\n" + \ |
496 |
+ writemsg(_("!!! Got: %s\n" |
497 |
"!!! Expected: %s\n") % \ |
498 |
(reason[1], reason[2]), noiselevel=-1) |
499 |
return False |
500 |
@@ -4103,7 +4071,7 @@ |
501 |
return (False, st) |
502 |
if not digests: |
503 |
if size is not None: |
504 |
- eout.ebegin("%s %s ;-)" % (os.path.basename(filename), "size")) |
505 |
+ eout.ebegin(_("%s size ;-)") % os.path.basename(filename)) |
506 |
eout.eend(0) |
507 |
elif st.st_size == 0: |
508 |
# Zero-byte distfiles are always invalid. |
509 |
@@ -4150,7 +4118,7 @@ |
510 |
if ("mirror" in features) and ("lmirror" not in features): |
511 |
# lmirror should allow you to bypass mirror restrictions. |
512 |
# XXX: This is not a good thing, and is temporary at best. |
513 |
- print ">>> \"mirror\" mode desired and \"mirror\" restriction found; skipping fetch." |
514 |
+ print _(">>> \"mirror\" mode desired and \"mirror\" restriction found; skipping fetch.") |
515 |
return 1 |
516 |
|
517 |
# Generally, downloading the same file repeatedly from |
518 |
@@ -4162,18 +4130,18 @@ |
519 |
v = int(mysettings.get("PORTAGE_FETCH_CHECKSUM_TRY_MIRRORS", |
520 |
checksum_failure_max_tries)) |
521 |
except (ValueError, OverflowError): |
522 |
- writemsg("!!! Variable PORTAGE_FETCH_CHECKSUM_TRY_MIRRORS" + \ |
523 |
- " contains non-integer value: '%s'\n" % \ |
524 |
+ writemsg(_("!!! Variable PORTAGE_FETCH_CHECKSUM_TRY_MIRRORS" |
525 |
+ " contains non-integer value: '%s'\n") % \ |
526 |
mysettings["PORTAGE_FETCH_CHECKSUM_TRY_MIRRORS"], noiselevel=-1) |
527 |
- writemsg("!!! Using PORTAGE_FETCH_CHECKSUM_TRY_MIRRORS " + \ |
528 |
- "default value: %s\n" % checksum_failure_max_tries, |
529 |
+ writemsg(_("!!! Using PORTAGE_FETCH_CHECKSUM_TRY_MIRRORS " |
530 |
+ "default value: %s\n") % checksum_failure_max_tries, |
531 |
noiselevel=-1) |
532 |
v = checksum_failure_max_tries |
533 |
if v < 1: |
534 |
- writemsg("!!! Variable PORTAGE_FETCH_CHECKSUM_TRY_MIRRORS" + \ |
535 |
- " contains value less than 1: '%s'\n" % v, noiselevel=-1) |
536 |
- writemsg("!!! Using PORTAGE_FETCH_CHECKSUM_TRY_MIRRORS " + \ |
537 |
- "default value: %s\n" % checksum_failure_max_tries, |
538 |
+ writemsg(_("!!! Variable PORTAGE_FETCH_CHECKSUM_TRY_MIRRORS" |
539 |
+ " contains value less than 1: '%s'\n") % v, noiselevel=-1) |
540 |
+ writemsg(_("!!! Using PORTAGE_FETCH_CHECKSUM_TRY_MIRRORS " |
541 |
+ "default value: %s\n") % checksum_failure_max_tries, |
542 |
noiselevel=-1) |
543 |
v = checksum_failure_max_tries |
544 |
checksum_failure_max_tries = v |
545 |
@@ -4189,11 +4157,11 @@ |
546 |
match = _fetch_resume_size_re.match(fetch_resume_size) |
547 |
if match is None or \ |
548 |
(match.group(2).upper() not in _size_suffix_map): |
549 |
- writemsg("!!! Variable PORTAGE_FETCH_RESUME_MIN_SIZE" + \ |
550 |
- " contains an unrecognized format: '%s'\n" % \ |
551 |
+ writemsg(_("!!! Variable PORTAGE_FETCH_RESUME_MIN_SIZE" |
552 |
+ " contains an unrecognized format: '%s'\n") % \ |
553 |
mysettings["PORTAGE_FETCH_RESUME_MIN_SIZE"], noiselevel=-1) |
554 |
- writemsg("!!! Using PORTAGE_FETCH_RESUME_MIN_SIZE " + \ |
555 |
- "default value: %s\n" % fetch_resume_size_default, |
556 |
+ writemsg(_("!!! Using PORTAGE_FETCH_RESUME_MIN_SIZE " |
557 |
+ "default value: %s\n") % fetch_resume_size_default, |
558 |
noiselevel=-1) |
559 |
fetch_resume_size = None |
560 |
if fetch_resume_size is None: |
561 |
@@ -4234,10 +4202,10 @@ |
562 |
if not os.access(mysettings["DISTDIR"],os.W_OK) and fetch_to_ro: |
563 |
if use_locks: |
564 |
writemsg(colorize("BAD", |
565 |
- "!!! For fetching to a read-only filesystem, " + \ |
566 |
- "locking should be turned off.\n"), noiselevel=-1) |
567 |
- writemsg("!!! This can be done by adding -distlocks to " + \ |
568 |
- "FEATURES in /etc/make.conf\n", noiselevel=-1) |
569 |
+ _("!!! For fetching to a read-only filesystem, " |
570 |
+ "locking should be turned off.\n")), noiselevel=-1) |
571 |
+ writemsg(_("!!! This can be done by adding -distlocks to " |
572 |
+ "FEATURES in /etc/make.conf\n"), noiselevel=-1) |
573 |
# use_locks = 0 |
574 |
|
575 |
# local mirrors are always added |
576 |
@@ -4322,9 +4290,9 @@ |
577 |
thirdpartymirror_uris.setdefault(myfile, []).extend(uris) |
578 |
|
579 |
if not filedict[myfile]: |
580 |
- writemsg("No known mirror by the name: %s\n" % (mirrorname)) |
581 |
+ writemsg(_("No known mirror by the name: %s\n") % (mirrorname)) |
582 |
else: |
583 |
- writemsg("Invalid mirror definition in SRC_URI:\n", noiselevel=-1) |
584 |
+ writemsg(_("Invalid mirror definition in SRC_URI:\n"), noiselevel=-1) |
585 |
writemsg(" %s\n" % (myuri), noiselevel=-1) |
586 |
else: |
587 |
if restrict_fetch: |
588 |
@@ -4394,7 +4362,7 @@ |
589 |
# The directory has just been created |
590 |
# and therefore it must be empty. |
591 |
continue |
592 |
- writemsg("Adjusting permissions recursively: '%s'\n" % mydir, |
593 |
+ writemsg(_("Adjusting permissions recursively: '%s'\n") % mydir, |
594 |
noiselevel=-1) |
595 |
def onerror(e): |
596 |
raise # bail out on the first error that occurs during recursion |
597 |
@@ -4402,24 +4370,24 @@ |
598 |
gid=dir_gid, dirmode=dirmode, dirmask=modemask, |
599 |
filemode=filemode, filemask=modemask, onerror=onerror): |
600 |
raise portage.exception.OperationNotPermitted( |
601 |
- "Failed to apply recursive permissions for the portage group.") |
602 |
+ _("Failed to apply recursive permissions for the portage group.")) |
603 |
except portage.exception.PortageException, e: |
604 |
if not os.path.isdir(mysettings["DISTDIR"]): |
605 |
writemsg("!!! %s\n" % str(e), noiselevel=-1) |
606 |
- writemsg("!!! Directory Not Found: DISTDIR='%s'\n" % mysettings["DISTDIR"], noiselevel=-1) |
607 |
- writemsg("!!! Fetching will fail!\n", noiselevel=-1) |
608 |
+ writemsg(_("!!! Directory Not Found: DISTDIR='%s'\n") % mysettings["DISTDIR"], noiselevel=-1) |
609 |
+ writemsg(_("!!! Fetching will fail!\n"), noiselevel=-1) |
610 |
|
611 |
if can_fetch and \ |
612 |
not fetch_to_ro and \ |
613 |
not os.access(mysettings["DISTDIR"], os.W_OK): |
614 |
- writemsg("!!! No write access to '%s'\n" % mysettings["DISTDIR"], |
615 |
+ writemsg(_("!!! No write access to '%s'\n") % mysettings["DISTDIR"], |
616 |
noiselevel=-1) |
617 |
can_fetch = False |
618 |
|
619 |
if can_fetch and use_locks and locks_in_subdir: |
620 |
distlocks_subdir = os.path.join(mysettings["DISTDIR"], locks_in_subdir) |
621 |
if not os.access(distlocks_subdir, os.W_OK): |
622 |
- writemsg("!!! No write access to write to %s. Aborting.\n" % distlocks_subdir, |
623 |
+ writemsg(_("!!! No write access to write to %s. Aborting.\n") % distlocks_subdir, |
624 |
noiselevel=-1) |
625 |
return 0 |
626 |
del distlocks_subdir |
627 |
@@ -4483,16 +4451,16 @@ |
628 |
has_space = False |
629 |
|
630 |
if not has_space: |
631 |
- writemsg("!!! Insufficient space to store %s in %s\n" % \ |
632 |
+ writemsg(_("!!! Insufficient space to store %s in %s\n") % \ |
633 |
(myfile, mysettings["DISTDIR"]), noiselevel=-1) |
634 |
|
635 |
if has_space_superuser: |
636 |
- writemsg("!!! Insufficient privileges to use " + \ |
637 |
- "remaining space.\n", noiselevel=-1) |
638 |
+ writemsg(_("!!! Insufficient privileges to use " |
639 |
+ "remaining space.\n"), noiselevel=-1) |
640 |
if userfetch: |
641 |
- writemsg("!!! You may set FEATURES=\"-userfetch\"" + \ |
642 |
- " in /etc/make.conf in order to fetch with\n" + \ |
643 |
- "!!! superuser privileges.\n", noiselevel=-1) |
644 |
+ writemsg(_("!!! You may set FEATURES=\"-userfetch\"" |
645 |
+ " in /etc/make.conf in order to fetch with\n" |
646 |
+ "!!! superuser privileges.\n"), noiselevel=-1) |
647 |
|
648 |
if distdir_writable and use_locks: |
649 |
|
650 |
@@ -4510,7 +4478,7 @@ |
651 |
file_lock = portage.locks.lockfile(myfile_path, |
652 |
wantnewlockfile=1, **lock_kwargs) |
653 |
except portage.exception.TryAgain: |
654 |
- writemsg((">>> File '%s' is already locked by " + \ |
655 |
+ writemsg(_(">>> File '%s' is already locked by " |
656 |
"another fetcher. Continuing...\n") % myfile, |
657 |
noiselevel=-1) |
658 |
continue |
659 |
@@ -4529,8 +4497,8 @@ |
660 |
stat_cached=mystat) |
661 |
except portage.exception.PortageException, e: |
662 |
if not os.access(myfile_path, os.R_OK): |
663 |
- writemsg("!!! Failed to adjust permissions:" + \ |
664 |
- " %s\n" % str(e), noiselevel=-1) |
665 |
+ writemsg(_("!!! Failed to adjust permissions:" |
666 |
+ " %s\n") % str(e), noiselevel=-1) |
667 |
del e |
668 |
continue |
669 |
|
670 |
@@ -4544,8 +4512,8 @@ |
671 |
if mystat is not None: |
672 |
if stat.S_ISDIR(mystat.st_mode): |
673 |
portage.util.writemsg_level( |
674 |
- ("!!! Unable to fetch file since " + \ |
675 |
- "a directory is in the way: \n" + \ |
676 |
+ _("!!! Unable to fetch file since " |
677 |
+ "a directory is in the way: \n" |
678 |
"!!! %s\n") % myfile_path, |
679 |
level=logging.ERROR, noiselevel=-1) |
680 |
return 0 |
681 |
@@ -4567,21 +4535,21 @@ |
682 |
# in order to force the old digests to be replaced. |
683 |
# Since the user may want to keep this file, rename |
684 |
# it instead of deleting it. |
685 |
- writemsg((">>> Renaming distfile with size " + \ |
686 |
- "%d (smaller than " "PORTAGE_FETCH_RESU" + \ |
687 |
+ writemsg(_(">>> Renaming distfile with size " |
688 |
+ "%d (smaller than " "PORTAGE_FETCH_RESU" |
689 |
"ME_MIN_SIZE)\n") % mystat.st_size) |
690 |
temp_filename = \ |
691 |
_checksum_failure_temp_file( |
692 |
mysettings["DISTDIR"], myfile) |
693 |
- writemsg_stdout("Refetching... " + \ |
694 |
- "File renamed to '%s'\n\n" % \ |
695 |
+ writemsg_stdout(_("Refetching... " |
696 |
+ "File renamed to '%s'\n\n") % \ |
697 |
temp_filename, noiselevel=-1) |
698 |
elif mystat.st_size >= size: |
699 |
temp_filename = \ |
700 |
_checksum_failure_temp_file( |
701 |
mysettings["DISTDIR"], myfile) |
702 |
- writemsg_stdout("Refetching... " + \ |
703 |
- "File renamed to '%s'\n\n" % \ |
704 |
+ writemsg_stdout(_("Refetching... " |
705 |
+ "File renamed to '%s'\n\n") % \ |
706 |
temp_filename, noiselevel=-1) |
707 |
|
708 |
if distdir_writable and ro_distdirs: |
709 |
@@ -4608,8 +4576,7 @@ |
710 |
mirror_file = os.path.join(mydir, myfile) |
711 |
try: |
712 |
shutil.copyfile(mirror_file, myfile_path) |
713 |
- writemsg(_("Local mirror has file:" + \ |
714 |
- " %(file)s\n" % {"file":myfile})) |
715 |
+ writemsg(_("Local mirror has file: %s\n") % myfile) |
716 |
break |
717 |
except (IOError, OSError), e: |
718 |
if e.errno not in (errno.ENOENT, errno.ESTALE): |
719 |
@@ -4629,8 +4596,8 @@ |
720 |
stat_cached=mystat) |
721 |
except portage.exception.PortageException, e: |
722 |
if not os.access(myfile_path, os.R_OK): |
723 |
- writemsg("!!! Failed to adjust permissions:" + \ |
724 |
- " %s\n" % str(e), noiselevel=-1) |
725 |
+ writemsg(_("!!! Failed to adjust permissions:" |
726 |
+ " %s\n") % str(e), noiselevel=-1) |
727 |
|
728 |
# If the file is empty then it's obviously invalid. Remove |
729 |
# the empty file and try to download if possible. |
730 |
@@ -4661,21 +4628,21 @@ |
731 |
verified_ok, reason = portage.checksum.verify_all( |
732 |
myfile_path, mydigests[myfile]) |
733 |
if not verified_ok: |
734 |
- writemsg("!!! Previously fetched" + \ |
735 |
- " file: '%s'\n" % myfile, noiselevel=-1) |
736 |
- writemsg("!!! Reason: %s\n" % reason[0], |
737 |
+ writemsg(_("!!! Previously fetched" |
738 |
+ " file: '%s'\n") % myfile, noiselevel=-1) |
739 |
+ writemsg(_("!!! Reason: %s\n") % reason[0], |
740 |
noiselevel=-1) |
741 |
- writemsg(("!!! Got: %s\n" + \ |
742 |
+ writemsg(_("!!! Got: %s\n" |
743 |
"!!! Expected: %s\n") % \ |
744 |
(reason[1], reason[2]), noiselevel=-1) |
745 |
- if reason[0] == "Insufficient data for checksum verification": |
746 |
+ if reason[0] == _("Insufficient data for checksum verification"): |
747 |
return 0 |
748 |
if distdir_writable: |
749 |
temp_filename = \ |
750 |
_checksum_failure_temp_file( |
751 |
mysettings["DISTDIR"], myfile) |
752 |
- writemsg_stdout("Refetching... " + \ |
753 |
- "File renamed to '%s'\n\n" % \ |
754 |
+ writemsg_stdout(_("Refetching... " |
755 |
+ "File renamed to '%s'\n\n") % \ |
756 |
temp_filename, noiselevel=-1) |
757 |
else: |
758 |
eout = portage.output.EOutput() |
759 |
@@ -4716,7 +4683,7 @@ |
760 |
fetchcommand = mysettings.get(fetchcommand_var) |
761 |
if fetchcommand is None: |
762 |
portage.util.writemsg_level( |
763 |
- ("!!! %s is unset. It should " + \ |
764 |
+ _("!!! %s is unset. It should " |
765 |
"have been defined in\n!!! %s/make.globals.\n") \ |
766 |
% (fetchcommand_var, |
767 |
portage.const.GLOBAL_CONFIG_PATH), |
768 |
@@ -4724,7 +4691,7 @@ |
769 |
return 0 |
770 |
if "${FILE}" not in fetchcommand: |
771 |
portage.util.writemsg_level( |
772 |
- ("!!! %s does not contain the required ${FILE}" + \ |
773 |
+ _("!!! %s does not contain the required ${FILE}" |
774 |
" parameter.\n") % fetchcommand_var, |
775 |
level=logging.ERROR, noiselevel=-1) |
776 |
missing_file_param = True |
777 |
@@ -4736,7 +4703,7 @@ |
778 |
resumecommand = mysettings.get(resumecommand_var) |
779 |
if resumecommand is None: |
780 |
portage.util.writemsg_level( |
781 |
- ("!!! %s is unset. It should " + \ |
782 |
+ _("!!! %s is unset. It should " |
783 |
"have been defined in\n!!! %s/make.globals.\n") \ |
784 |
% (resumecommand_var, |
785 |
portage.const.GLOBAL_CONFIG_PATH), |
786 |
@@ -4744,16 +4711,16 @@ |
787 |
return 0 |
788 |
if "${FILE}" not in resumecommand: |
789 |
portage.util.writemsg_level( |
790 |
- ("!!! %s does not contain the required ${FILE}" + \ |
791 |
+ _("!!! %s does not contain the required ${FILE}" |
792 |
" parameter.\n") % resumecommand_var, |
793 |
level=logging.ERROR, noiselevel=-1) |
794 |
missing_file_param = True |
795 |
|
796 |
if missing_file_param: |
797 |
portage.util.writemsg_level( |
798 |
- "!!! Refer to the make.conf(5) man page for " + \ |
799 |
- "information about how to\n!!! correctly specify " + \ |
800 |
- "FETCHCOMMAND and RESUMECOMMAND.\n", |
801 |
+ _("!!! Refer to the make.conf(5) man page for " |
802 |
+ "information about how to\n!!! correctly specify " |
803 |
+ "FETCHCOMMAND and RESUMECOMMAND.\n"), |
804 |
level=logging.ERROR, noiselevel=-1) |
805 |
if myfile != os.path.basename(loc): |
806 |
return 0 |
807 |
@@ -4769,13 +4736,13 @@ |
808 |
mysize = 0 |
809 |
|
810 |
if mysize == 0: |
811 |
- writemsg("!!! File %s isn't fetched but unable to get it.\n" % myfile, |
812 |
+ writemsg(_("!!! File %s isn't fetched but unable to get it.\n") % myfile, |
813 |
noiselevel=-1) |
814 |
elif size is None or size > mysize: |
815 |
- writemsg("!!! File %s isn't fully fetched, but unable to complete it\n" % myfile, |
816 |
+ writemsg(_("!!! File %s isn't fully fetched, but unable to complete it\n") % myfile, |
817 |
noiselevel=-1) |
818 |
else: |
819 |
- writemsg(("!!! File %s is incorrect size, " + \ |
820 |
+ writemsg(_("!!! File %s is incorrect size, " |
821 |
"but unable to retry.\n") % myfile, noiselevel=-1) |
822 |
return 0 |
823 |
else: |
824 |
@@ -4793,8 +4760,8 @@ |
825 |
fetched = 0 |
826 |
else: |
827 |
if mystat.st_size < fetch_resume_size: |
828 |
- writemsg((">>> Deleting distfile with size " + \ |
829 |
- "%d (smaller than " "PORTAGE_FETCH_RESU" + \ |
830 |
+ writemsg(_(">>> Deleting distfile with size " |
831 |
+ "%d (smaller than " "PORTAGE_FETCH_RESU" |
832 |
"ME_MIN_SIZE)\n") % mystat.st_size) |
833 |
try: |
834 |
os.unlink(myfile_path) |
835 |
@@ -4806,14 +4773,14 @@ |
836 |
fetched = 0 |
837 |
if fetched == 1: |
838 |
#resume mode: |
839 |
- writemsg(">>> Resuming download...\n") |
840 |
+ writemsg(_(">>> Resuming download...\n")) |
841 |
locfetch=resumecommand |
842 |
command_var = resumecommand_var |
843 |
else: |
844 |
#normal mode: |
845 |
locfetch=fetchcommand |
846 |
command_var = fetchcommand_var |
847 |
- writemsg_stdout(">>> Downloading '%s'\n" % \ |
848 |
+ writemsg_stdout(_(">>> Downloading '%s'\n") % \ |
849 |
re.sub(r'//(.+):.+@(.+)/',r'//\1:*password*@\2/', loc)) |
850 |
variables = { |
851 |
"DISTDIR": mysettings["DISTDIR"], |
852 |
@@ -4836,8 +4803,8 @@ |
853 |
pass |
854 |
except portage.exception.PortageException, e: |
855 |
if not os.access(myfile_path, os.R_OK): |
856 |
- writemsg("!!! Failed to adjust permissions:" + \ |
857 |
- " %s\n" % str(e), noiselevel=-1) |
858 |
+ writemsg(_("!!! Failed to adjust permissions:" |
859 |
+ " %s\n") % str(e), noiselevel=-1) |
860 |
|
861 |
# If the file is empty then it's obviously invalid. Don't |
862 |
# trust the return value from the fetcher. Remove the |
863 |
@@ -4865,16 +4832,16 @@ |
864 |
# contains wget's -P option where it should |
865 |
# instead have -O. |
866 |
portage.util.writemsg_level( |
867 |
- ("!!! The command specified in the " + \ |
868 |
- "%s variable appears to have\n!!! " + \ |
869 |
- "created a directory instead of a " + \ |
870 |
+ _("!!! The command specified in the " |
871 |
+ "%s variable appears to have\n!!! " |
872 |
+ "created a directory instead of a " |
873 |
"normal file.\n") % command_var, |
874 |
level=logging.ERROR, noiselevel=-1) |
875 |
portage.util.writemsg_level( |
876 |
- "!!! Refer to the make.conf(5) " + \ |
877 |
- "man page for information about how " + \ |
878 |
- "to\n!!! correctly specify " + \ |
879 |
- "FETCHCOMMAND and RESUMECOMMAND.\n", |
880 |
+ _("!!! Refer to the make.conf(5) " |
881 |
+ "man page for information about how " |
882 |
+ "to\n!!! correctly specify " |
883 |
+ "FETCHCOMMAND and RESUMECOMMAND.\n"), |
884 |
level=logging.ERROR, noiselevel=-1) |
885 |
return 0 |
886 |
|
887 |
@@ -4898,7 +4865,7 @@ |
888 |
).read()): |
889 |
try: |
890 |
os.unlink(mysettings["DISTDIR"]+"/"+myfile) |
891 |
- writemsg(">>> Deleting invalid distfile. (Improper 404 redirect from server.)\n") |
892 |
+ writemsg(_(">>> Deleting invalid distfile. (Improper 404 redirect from server.)\n")) |
893 |
fetched = 0 |
894 |
continue |
895 |
except (IOError, OSError): |
896 |
@@ -4913,19 +4880,19 @@ |
897 |
verified_ok,reason = portage.checksum.verify_all(mysettings["DISTDIR"]+"/"+myfile, mydigests[myfile]) |
898 |
if not verified_ok: |
899 |
print reason |
900 |
- writemsg("!!! Fetched file: "+str(myfile)+" VERIFY FAILED!\n", |
901 |
+ writemsg(_("!!! Fetched file: %s VERIFY FAILED!\n") % myfile, |
902 |
noiselevel=-1) |
903 |
- writemsg("!!! Reason: "+reason[0]+"\n", |
904 |
+ writemsg(_("!!! Reason: %s\n") % reason[0], |
905 |
noiselevel=-1) |
906 |
- writemsg("!!! Got: %s\n!!! Expected: %s\n" % \ |
907 |
+ writemsg(_("!!! Got: %s\n!!! Expected: %s\n") % \ |
908 |
(reason[1], reason[2]), noiselevel=-1) |
909 |
- if reason[0] == "Insufficient data for checksum verification": |
910 |
+ if reason[0] == _("Insufficient data for checksum verification"): |
911 |
return 0 |
912 |
temp_filename = \ |
913 |
_checksum_failure_temp_file( |
914 |
mysettings["DISTDIR"], myfile) |
915 |
- writemsg_stdout("Refetching... " + \ |
916 |
- "File renamed to '%s'\n\n" % \ |
917 |
+ writemsg_stdout(_("Refetching... " |
918 |
+ "File renamed to '%s'\n\n") % \ |
919 |
temp_filename, noiselevel=-1) |
920 |
fetched=0 |
921 |
checksum_failure_count += 1 |
922 |
@@ -4957,7 +4924,7 @@ |
923 |
fetched=2 |
924 |
break |
925 |
elif mydigests!=None: |
926 |
- writemsg("No digest file available and download failed.\n\n", |
927 |
+ writemsg(_("No digest file available and download failed.\n\n"), |
928 |
noiselevel=-1) |
929 |
finally: |
930 |
if use_locks and file_lock: |
931 |
@@ -4968,11 +4935,11 @@ |
932 |
if fetched != 2: |
933 |
if restrict_fetch and not restrict_fetch_msg: |
934 |
restrict_fetch_msg = True |
935 |
- msg = ("\n!!! %s/%s" + \ |
936 |
- " has fetch restriction turned on.\n" + \ |
937 |
- "!!! This probably means that this " + \ |
938 |
- "ebuild's files must be downloaded\n" + \ |
939 |
- "!!! manually. See the comments in" + \ |
940 |
+ msg = _("\n!!! %s/%s" |
941 |
+ " has fetch restriction turned on.\n" |
942 |
+ "!!! This probably means that this " |
943 |
+ "ebuild's files must be downloaded\n" |
944 |
+ "!!! manually. See the comments in" |
945 |
" the ebuild for more information.\n\n") % \ |
946 |
(mysettings["CATEGORY"], mysettings["PF"]) |
947 |
portage.util.writemsg_level(msg, |
948 |
@@ -5038,10 +5005,10 @@ |
949 |
elif listonly: |
950 |
pass |
951 |
elif not filedict[myfile]: |
952 |
- writemsg("Warning: No mirrors available for file" + \ |
953 |
- " '%s'\n" % (myfile), noiselevel=-1) |
954 |
+ writemsg(_("Warning: No mirrors available for file" |
955 |
+ " '%s'\n") % (myfile), noiselevel=-1) |
956 |
else: |
957 |
- writemsg("!!! Couldn't download '%s'. Aborting.\n" % myfile, |
958 |
+ writemsg(_("!!! Couldn't download '%s'. Aborting.\n") % myfile, |
959 |
noiselevel=-1) |
960 |
|
961 |
if listonly: |
962 |
@@ -5154,30 +5121,30 @@ |
963 |
st = None |
964 |
|
965 |
if not fetch({myfile : uris}, fetch_settings): |
966 |
- writemsg(("!!! Fetch failed for %s, can't update " + \ |
967 |
+ writemsg(_("!!! Fetch failed for %s, can't update " |
968 |
"Manifest\n") % myfile, noiselevel=-1) |
969 |
if myfile in dist_hashes and \ |
970 |
st is not None and st.st_size > 0: |
971 |
# stat result is obtained before calling fetch(), |
972 |
# since fetch may rename the existing file if the |
973 |
# digest does not match. |
974 |
- writemsg("!!! If you would like to " + \ |
975 |
- "forcefully replace the existing " + \ |
976 |
- "Manifest entry\n!!! for %s, use the " % \ |
977 |
- myfile + "following command:\n" + \ |
978 |
+ writemsg(_("!!! If you would like to " |
979 |
+ "forcefully replace the existing " |
980 |
+ "Manifest entry\n!!! for %s, use " |
981 |
+ "the following command:\n") % myfile + \ |
982 |
"!!! " + colorize("INFORM", |
983 |
"ebuild --force %s manifest" % \ |
984 |
os.path.basename(myebuild)) + "\n", |
985 |
noiselevel=-1) |
986 |
return 0 |
987 |
- writemsg_stdout(">>> Creating Manifest for %s\n" % mysettings["O"]) |
988 |
+ writemsg_stdout(_(">>> Creating Manifest for %s\n") % mysettings["O"]) |
989 |
try: |
990 |
mf.create(requiredDistfiles=myarchives, |
991 |
assumeDistHashesSometimes=True, |
992 |
assumeDistHashesAlways=( |
993 |
"assume-digests" in mysettings.features)) |
994 |
except portage.exception.FileNotFound, e: |
995 |
- writemsg(("!!! File %s doesn't exist, can't update " + \ |
996 |
+ writemsg(_("!!! File %s doesn't exist, can't update " |
997 |
"Manifest\n") % e, noiselevel=-1) |
998 |
return 0 |
999 |
except portage.exception.PortagePackageException, e: |
1000 |
@@ -5186,7 +5153,7 @@ |
1001 |
try: |
1002 |
mf.write(sign=False) |
1003 |
except portage.exception.PermissionDenied, e: |
1004 |
- writemsg("!!! Permission Denied: %s\n" % (e,), noiselevel=-1) |
1005 |
+ writemsg(_("!!! Permission Denied: %s\n") % (e,), noiselevel=-1) |
1006 |
return 0 |
1007 |
if "assume-digests" not in mysettings.features: |
1008 |
distlist = mf.fhashdict.get("DIST", {}).keys() |
1009 |
@@ -5245,7 +5212,7 @@ |
1010 |
pkgdir = mysettings["O"] |
1011 |
manifest_path = os.path.join(pkgdir, "Manifest") |
1012 |
if not os.path.exists(manifest_path): |
1013 |
- writemsg("!!! Manifest file not found: '%s'\n" % manifest_path, |
1014 |
+ writemsg(_("!!! Manifest file not found: '%s'\n") % manifest_path, |
1015 |
noiselevel=-1) |
1016 |
if strict: |
1017 |
return 0 |
1018 |
@@ -5258,7 +5225,7 @@ |
1019 |
manifest_empty = False |
1020 |
break |
1021 |
if manifest_empty: |
1022 |
- writemsg("!!! Manifest is empty: '%s'\n" % manifest_path, |
1023 |
+ writemsg(_("!!! Manifest is empty: '%s'\n") % manifest_path, |
1024 |
noiselevel=-1) |
1025 |
if strict: |
1026 |
return 0 |
1027 |
@@ -5268,17 +5235,17 @@ |
1028 |
eout.quiet = mysettings.get("PORTAGE_QUIET", None) == "1" |
1029 |
try: |
1030 |
if strict and "PORTAGE_PARALLEL_FETCHONLY" not in mysettings: |
1031 |
- eout.ebegin("checking ebuild checksums ;-)") |
1032 |
+ eout.ebegin(_("checking ebuild checksums ;-)")) |
1033 |
mf.checkTypeHashes("EBUILD") |
1034 |
eout.eend(0) |
1035 |
- eout.ebegin("checking auxfile checksums ;-)") |
1036 |
+ eout.ebegin(_("checking auxfile checksums ;-)")) |
1037 |
mf.checkTypeHashes("AUX") |
1038 |
eout.eend(0) |
1039 |
- eout.ebegin("checking miscfile checksums ;-)") |
1040 |
+ eout.ebegin(_("checking miscfile checksums ;-)")) |
1041 |
mf.checkTypeHashes("MISC", ignoreMissingFiles=True) |
1042 |
eout.eend(0) |
1043 |
for f in myfiles: |
1044 |
- eout.ebegin("checking %s ;-)" % f) |
1045 |
+ eout.ebegin(_("checking %s ;-)") % f) |
1046 |
ftype = mf.findFile(f) |
1047 |
if ftype is None: |
1048 |
raise KeyError(f) |
1049 |
@@ -5286,20 +5253,20 @@ |
1050 |
eout.eend(0) |
1051 |
except KeyError, e: |
1052 |
eout.eend(1) |
1053 |
- writemsg("\n!!! Missing digest for %s\n" % str(e), noiselevel=-1) |
1054 |
+ writemsg(_("\n!!! Missing digest for %s\n") % str(e), noiselevel=-1) |
1055 |
return 0 |
1056 |
except portage.exception.FileNotFound, e: |
1057 |
eout.eend(1) |
1058 |
- writemsg("\n!!! A file listed in the Manifest could not be found: %s\n" % str(e), |
1059 |
+ writemsg(_("\n!!! A file listed in the Manifest could not be found: %s\n") % str(e), |
1060 |
noiselevel=-1) |
1061 |
return 0 |
1062 |
except portage.exception.DigestException, e: |
1063 |
eout.eend(1) |
1064 |
- writemsg("\n!!! Digest verification failed:\n", noiselevel=-1) |
1065 |
+ writemsg(_("\n!!! Digest verification failed:\n"), noiselevel=-1) |
1066 |
writemsg("!!! %s\n" % e.value[0], noiselevel=-1) |
1067 |
- writemsg("!!! Reason: %s\n" % e.value[1], noiselevel=-1) |
1068 |
- writemsg("!!! Got: %s\n" % e.value[2], noiselevel=-1) |
1069 |
- writemsg("!!! Expected: %s\n" % e.value[3], noiselevel=-1) |
1070 |
+ writemsg(_("!!! Reason: %s\n") % e.value[1], noiselevel=-1) |
1071 |
+ writemsg(_("!!! Got: %s\n") % e.value[2], noiselevel=-1) |
1072 |
+ writemsg(_("!!! Expected: %s\n") % e.value[3], noiselevel=-1) |
1073 |
return 0 |
1074 |
# Make sure that all of the ebuilds are actually listed in the Manifest. |
1075 |
glep55 = 'parse-eapi-glep-55' in mysettings.features |
1076 |
@@ -5310,7 +5277,7 @@ |
1077 |
elif f[-7:] == '.ebuild': |
1078 |
pf = f[:-7] |
1079 |
if pf is not None and not mf.hasFile("EBUILD", f): |
1080 |
- writemsg("!!! A file is not listed in the Manifest: '%s'\n" % \ |
1081 |
+ writemsg(_("!!! A file is not listed in the Manifest: '%s'\n") % \ |
1082 |
os.path.join(pkgdir, f), noiselevel=-1) |
1083 |
if strict: |
1084 |
return 0 |
1085 |
@@ -5325,8 +5292,8 @@ |
1086 |
except UnicodeDecodeError: |
1087 |
parent = _unicode_decode(parent, |
1088 |
encoding=_fs_encoding, errors='replace') |
1089 |
- writemsg("!!! Path contains invalid " + \ |
1090 |
- "character(s) for encoding '%s': '%s'" \ |
1091 |
+ writemsg(_("!!! Path contains invalid " |
1092 |
+ "character(s) for encoding '%s': '%s'") \ |
1093 |
% (_fs_encoding, parent), noiselevel=-1) |
1094 |
if strict: |
1095 |
return 0 |
1096 |
@@ -5344,8 +5311,8 @@ |
1097 |
if f.startswith("."): |
1098 |
continue |
1099 |
f = os.path.join(parent, f)[len(filesdir) + 1:] |
1100 |
- writemsg("!!! File name contains invalid " + \ |
1101 |
- "character(s) for encoding '%s': '%s'" \ |
1102 |
+ writemsg(_("!!! File name contains invalid " |
1103 |
+ "character(s) for encoding '%s': '%s'") \ |
1104 |
% (_fs_encoding, f), noiselevel=-1) |
1105 |
if strict: |
1106 |
return 0 |
1107 |
@@ -5355,7 +5322,7 @@ |
1108 |
f = os.path.join(parent, f)[len(filesdir) + 1:] |
1109 |
file_type = mf.findFile(f) |
1110 |
if file_type != "AUX" and not f.startswith("digest-"): |
1111 |
- writemsg("!!! A file is not listed in the Manifest: '%s'\n" % \ |
1112 |
+ writemsg(_("!!! A file is not listed in the Manifest: '%s'\n") % \ |
1113 |
os.path.join(filesdir, f), noiselevel=-1) |
1114 |
if strict: |
1115 |
return 0 |
1116 |
@@ -5452,7 +5419,7 @@ |
1117 |
global _post_phase_cmds |
1118 |
retval = _spawn_misc_sh(mysettings, _post_phase_cmds["install"]) |
1119 |
if retval != os.EX_OK: |
1120 |
- writemsg("!!! install_qa_check failed; exiting.\n", |
1121 |
+ writemsg(_("!!! install_qa_check failed; exiting.\n"), |
1122 |
noiselevel=-1) |
1123 |
return retval |
1124 |
|
1125 |
@@ -5529,43 +5496,43 @@ |
1126 |
wrap_width = 70 |
1127 |
|
1128 |
if am_maintainer_mode: |
1129 |
- msg = ["QA Notice: Automake \"maintainer mode\" detected:"] |
1130 |
+ msg = [_("QA Notice: Automake \"maintainer mode\" detected:")] |
1131 |
msg.append("") |
1132 |
msg.extend("\t" + line for line in am_maintainer_mode) |
1133 |
msg.append("") |
1134 |
- msg.extend(wrap( |
1135 |
- "If you patch Makefile.am, " + \ |
1136 |
- "configure.in, or configure.ac then you " + \ |
1137 |
- "should use autotools.eclass and " + \ |
1138 |
- "eautomake or eautoreconf. Exceptions " + \ |
1139 |
- "are limited to system packages " + \ |
1140 |
- "for which it is impossible to run " + \ |
1141 |
- "autotools during stage building. " + \ |
1142 |
- "See http://www.gentoo.org/p" + \ |
1143 |
- "roj/en/qa/autofailure.xml for more information.", |
1144 |
+ msg.extend(wrap(_( |
1145 |
+ "If you patch Makefile.am, " |
1146 |
+ "configure.in, or configure.ac then you " |
1147 |
+ "should use autotools.eclass and " |
1148 |
+ "eautomake or eautoreconf. Exceptions " |
1149 |
+ "are limited to system packages " |
1150 |
+ "for which it is impossible to run " |
1151 |
+ "autotools during stage building. " |
1152 |
+ "See http://www.gentoo.org/p" |
1153 |
+ "roj/en/qa/autofailure.xml for more information."), |
1154 |
wrap_width)) |
1155 |
_eqawarn(msg) |
1156 |
|
1157 |
if bash_command_not_found: |
1158 |
- msg = ["QA Notice: command not found:"] |
1159 |
+ msg = [_("QA Notice: command not found:")] |
1160 |
msg.append("") |
1161 |
msg.extend("\t" + line for line in bash_command_not_found) |
1162 |
_eqawarn(msg) |
1163 |
|
1164 |
if helper_missing_file: |
1165 |
- msg = ["QA Notice: file does not exist:"] |
1166 |
+ msg = [_("QA Notice: file does not exist:")] |
1167 |
msg.append("") |
1168 |
msg.extend("\t" + line[4:] for line in helper_missing_file) |
1169 |
_eqawarn(msg) |
1170 |
|
1171 |
if configure_opts_warn: |
1172 |
- msg = ["QA Notice: Unrecognized configure options:"] |
1173 |
+ msg = [_("QA Notice: Unrecognized configure options:")] |
1174 |
msg.append("") |
1175 |
msg.extend("\t" + line for line in configure_opts_warn) |
1176 |
_eqawarn(msg) |
1177 |
|
1178 |
if make_jobserver: |
1179 |
- msg = ["QA Notice: make jobserver unavailable:"] |
1180 |
+ msg = [_("QA Notice: make jobserver unavailable:")] |
1181 |
msg.append("") |
1182 |
msg.extend("\t" + line for line in make_jobserver) |
1183 |
_eqawarn(msg) |
1184 |
@@ -5696,9 +5663,9 @@ |
1185 |
from textwrap import wrap |
1186 |
lines = [] |
1187 |
|
1188 |
- msg = "This package installs one or more file names containing " + \ |
1189 |
- "characters that do not match your current locale " + \ |
1190 |
- "settings. The current setting for filesystem encoding is '%s'." \ |
1191 |
+ msg = _("This package installs one or more file names containing " |
1192 |
+ "characters that do not match your current locale " |
1193 |
+ "settings. The current setting for filesystem encoding is '%s'.") \ |
1194 |
% _merge_encoding |
1195 |
lines.extend(wrap(msg, 72)) |
1196 |
|
1197 |
@@ -5708,9 +5675,9 @@ |
1198 |
lines.append("") |
1199 |
|
1200 |
if _merge_encoding.lower().replace('_', '').replace('-', '') != 'utf8': |
1201 |
- msg = "For best results, UTF-8 encoding is recommended. See " + \ |
1202 |
- "the Gentoo Linux Localization Guide for instructions " + \ |
1203 |
- "about how to configure your locale for UTF-8 encoding:" |
1204 |
+ msg = _("For best results, UTF-8 encoding is recommended. See " |
1205 |
+ "the Gentoo Linux Localization Guide for instructions " |
1206 |
+ "about how to configure your locale for UTF-8 encoding:") |
1207 |
lines.extend(wrap(msg, 72)) |
1208 |
lines.append("") |
1209 |
lines.append("\t" + \ |
1210 |
@@ -5874,7 +5841,7 @@ |
1211 |
mysplit=pkgsplit(mypv,silent=0) |
1212 |
if mysplit is None: |
1213 |
raise portage.exception.IncorrectParameter( |
1214 |
- "Invalid ebuild path: '%s'" % myebuild) |
1215 |
+ _("Invalid ebuild path: '%s'") % myebuild) |
1216 |
|
1217 |
# Make a backup of PORTAGE_TMPDIR prior to calling config.reset() |
1218 |
# so that the caller can override it. |
1219 |
@@ -6048,7 +6015,7 @@ |
1220 |
pass |
1221 |
elif errno.EPERM == oe.errno: |
1222 |
writemsg("%s\n" % oe, noiselevel=-1) |
1223 |
- writemsg("Operation Not Permitted: rmtree('%s')\n" % \ |
1224 |
+ writemsg(_("Operation Not Permitted: rmtree('%s')\n") % \ |
1225 |
clean_dir, noiselevel=-1) |
1226 |
return 1 |
1227 |
else: |
1228 |
@@ -6062,7 +6029,7 @@ |
1229 |
pass |
1230 |
elif errno.EPERM == oe.errno: |
1231 |
writemsg("%s\n" % oe, noiselevel=-1) |
1232 |
- writemsg("Operation Not Permitted: makedirs('%s')\n" % \ |
1233 |
+ writemsg(_("Operation Not Permitted: makedirs('%s')\n") % \ |
1234 |
dir_path, noiselevel=-1) |
1235 |
return False |
1236 |
else: |
1237 |
@@ -6089,13 +6056,13 @@ |
1238 |
portage.util.apply_secpass_permissions(mysettings[dir_key], |
1239 |
uid=portage_uid, gid=portage_gid) |
1240 |
except portage.exception.PermissionDenied, e: |
1241 |
- writemsg("Permission Denied: %s\n" % str(e), noiselevel=-1) |
1242 |
+ writemsg(_("Permission Denied: %s\n") % str(e), noiselevel=-1) |
1243 |
return 1 |
1244 |
except portage.exception.OperationNotPermitted, e: |
1245 |
- writemsg("Operation Not Permitted: %s\n" % str(e), noiselevel=-1) |
1246 |
+ writemsg(_("Operation Not Permitted: %s\n") % str(e), noiselevel=-1) |
1247 |
return 1 |
1248 |
except portage.exception.FileNotFound, e: |
1249 |
- writemsg("File Not Found: '%s'\n" % str(e), noiselevel=-1) |
1250 |
+ writemsg(_("File Not Found: '%s'\n") % str(e), noiselevel=-1) |
1251 |
return 1 |
1252 |
|
1253 |
_prepare_workdir(mysettings) |
1254 |
@@ -6198,13 +6165,13 @@ |
1255 |
if droppriv_fix: |
1256 |
_adjust_perms_msg(mysettings, |
1257 |
colorize("WARN", " * ") + \ |
1258 |
- "Adjusting permissions " + \ |
1259 |
- "for FEATURES=userpriv: '%s'\n" % mydir) |
1260 |
+ _("Adjusting permissions " |
1261 |
+ "for FEATURES=userpriv: '%s'\n") % mydir) |
1262 |
elif modified: |
1263 |
_adjust_perms_msg(mysettings, |
1264 |
colorize("WARN", " * ") + \ |
1265 |
- "Adjusting permissions " + \ |
1266 |
- "for FEATURES=%s: '%s'\n" % (myfeature, mydir)) |
1267 |
+ _("Adjusting permissions " |
1268 |
+ "for FEATURES=%s: '%s'\n") % (myfeature, mydir)) |
1269 |
|
1270 |
if modified or kwargs["always_recurse"] or droppriv_fix: |
1271 |
def onerror(e): |
1272 |
@@ -6214,21 +6181,21 @@ |
1273 |
gid=portage_gid, dirmode=dirmode, dirmask=modemask, |
1274 |
filemode=filemode, filemask=modemask, onerror=onerror): |
1275 |
raise portage.exception.OperationNotPermitted( |
1276 |
- "Failed to apply recursive permissions for the portage group.") |
1277 |
+ _("Failed to apply recursive permissions for the portage group.")) |
1278 |
|
1279 |
except portage.exception.DirectoryNotFound, e: |
1280 |
failure = True |
1281 |
- writemsg("\n!!! Directory does not exist: '%s'\n" % \ |
1282 |
+ writemsg(_("\n!!! Directory does not exist: '%s'\n") % \ |
1283 |
(e,), noiselevel=-1) |
1284 |
- writemsg("!!! Disabled FEATURES='%s'\n" % myfeature, |
1285 |
+ writemsg(_("!!! Disabled FEATURES='%s'\n") % myfeature, |
1286 |
noiselevel=-1) |
1287 |
|
1288 |
except portage.exception.PortageException, e: |
1289 |
failure = True |
1290 |
writemsg("\n!!! %s\n" % str(e), noiselevel=-1) |
1291 |
- writemsg("!!! Failed resetting perms on %s='%s'\n" % \ |
1292 |
+ writemsg(_("!!! Failed resetting perms on %s='%s'\n") % \ |
1293 |
(kwargs["basedir_var"], basedir), noiselevel=-1) |
1294 |
- writemsg("!!! Disabled FEATURES='%s'\n" % myfeature, |
1295 |
+ writemsg(_("!!! Disabled FEATURES='%s'\n") % myfeature, |
1296 |
noiselevel=-1) |
1297 |
|
1298 |
if failure: |
1299 |
@@ -6251,11 +6218,11 @@ |
1300 |
else: |
1301 |
workdir_mode = parsed_mode |
1302 |
except KeyError, e: |
1303 |
- writemsg("!!! PORTAGE_WORKDIR_MODE is unset, using %s.\n" % oct(workdir_mode)) |
1304 |
+ writemsg(_("!!! PORTAGE_WORKDIR_MODE is unset, using %s.\n") % oct(workdir_mode)) |
1305 |
except ValueError, e: |
1306 |
if len(str(e)) > 0: |
1307 |
writemsg("%s\n" % e) |
1308 |
- writemsg("!!! Unable to parse PORTAGE_WORKDIR_MODE='%s', using %s.\n" % \ |
1309 |
+ writemsg(_("!!! Unable to parse PORTAGE_WORKDIR_MODE='%s', using %s.\n") % \ |
1310 |
(mysettings["PORTAGE_WORKDIR_MODE"], oct(workdir_mode))) |
1311 |
mysettings["PORTAGE_WORKDIR_MODE"] = oct(workdir_mode) |
1312 |
try: |
1313 |
@@ -6275,9 +6242,9 @@ |
1314 |
uid=portage_uid, gid=portage_gid, mode=02770) |
1315 |
except portage.exception.PortageException, e: |
1316 |
writemsg("!!! %s\n" % str(e), noiselevel=-1) |
1317 |
- writemsg("!!! Permission issues with PORT_LOGDIR='%s'\n" % \ |
1318 |
+ writemsg(_("!!! Permission issues with PORT_LOGDIR='%s'\n") % \ |
1319 |
mysettings["PORT_LOGDIR"], noiselevel=-1) |
1320 |
- writemsg("!!! Disabling logging.\n", noiselevel=-1) |
1321 |
+ writemsg(_("!!! Disabling logging.\n"), noiselevel=-1) |
1322 |
while "PORT_LOGDIR" in mysettings: |
1323 |
del mysettings["PORT_LOGDIR"] |
1324 |
if "PORT_LOGDIR" in mysettings and \ |
1325 |
@@ -6308,25 +6275,25 @@ |
1326 |
if not exit_status_file or \ |
1327 |
os.path.exists(exit_status_file): |
1328 |
return None |
1329 |
- msg = ("The ebuild phase '%s' has exited " % mydo) + \ |
1330 |
- "unexpectedly. This type of behavior " + \ |
1331 |
- "is known to be triggered " + \ |
1332 |
- "by things such as failed variable " + \ |
1333 |
- "assignments (bug #190128) or bad substitution " + \ |
1334 |
- "errors (bug #200313). Normally, before exiting, bash should " + \ |
1335 |
- "have displayed an error message above. If bash did not " + \ |
1336 |
- "produce an error message above, it's possible " + \ |
1337 |
- "that the ebuild has called `exit` when it " + \ |
1338 |
- "should have called `die` instead. This behavior may also " + \ |
1339 |
- "be triggered by a corrupt bash binary or a hardware " + \ |
1340 |
- "problem such as memory or cpu malfunction. If the problem is not " + \ |
1341 |
- "reproducible or it appears to occur randomly, then it is likely " + \ |
1342 |
- "to be triggered by a hardware problem. " + \ |
1343 |
- "If you suspect a hardware problem then you should " + \ |
1344 |
- "try some basic hardware diagnostics such as memtest. " + \ |
1345 |
- "Please do not report this as a bug unless it is consistently " + \ |
1346 |
- "reproducible and you are sure that your bash binary and hardware " + \ |
1347 |
- "are functioning properly." |
1348 |
+ msg = _("The ebuild phase '%s' has exited " |
1349 |
+ "unexpectedly. This type of behavior " |
1350 |
+ "is known to be triggered " |
1351 |
+ "by things such as failed variable " |
1352 |
+ "assignments (bug #190128) or bad substitution " |
1353 |
+ "errors (bug #200313). Normally, before exiting, bash should " |
1354 |
+ "have displayed an error message above. If bash did not " |
1355 |
+ "produce an error message above, it's possible " |
1356 |
+ "that the ebuild has called `exit` when it " |
1357 |
+ "should have called `die` instead. This behavior may also " |
1358 |
+ "be triggered by a corrupt bash binary or a hardware " |
1359 |
+ "problem such as memory or cpu malfunction. If the problem is not " |
1360 |
+ "reproducible or it appears to occur randomly, then it is likely " |
1361 |
+ "to be triggered by a hardware problem. " |
1362 |
+ "If you suspect a hardware problem then you should " |
1363 |
+ "try some basic hardware diagnostics such as memtest. " |
1364 |
+ "Please do not report this as a bug unless it is consistently " |
1365 |
+ "reproducible and you are sure that your bash binary and hardware " |
1366 |
+ "are functioning properly.") % mydo |
1367 |
return msg |
1368 |
|
1369 |
def _doebuild_exit_status_check_and_log(settings, mydo, retval): |
1370 |
@@ -6503,7 +6470,7 @@ |
1371 |
_doebuild_manifest_cache = None |
1372 |
if not os.path.exists(manifest_path): |
1373 |
out = portage.output.EOutput() |
1374 |
- out.eerror("Manifest not found for '%s'" % (myebuild,)) |
1375 |
+ out.eerror(_("Manifest not found for '%s'") % (myebuild,)) |
1376 |
_doebuild_broken_ebuilds.add(myebuild) |
1377 |
return 1 |
1378 |
mf = Manifest(pkgdir, mysettings["DISTDIR"]) |
1379 |
@@ -6515,22 +6482,22 @@ |
1380 |
mf.checkFileHashes("EBUILD", os.path.basename(myebuild)) |
1381 |
except KeyError: |
1382 |
out = portage.output.EOutput() |
1383 |
- out.eerror("Missing digest for '%s'" % (myebuild,)) |
1384 |
+ out.eerror(_("Missing digest for '%s'") % (myebuild,)) |
1385 |
_doebuild_broken_ebuilds.add(myebuild) |
1386 |
return 1 |
1387 |
except portage.exception.FileNotFound: |
1388 |
out = portage.output.EOutput() |
1389 |
- out.eerror("A file listed in the Manifest " + \ |
1390 |
- "could not be found: '%s'" % (myebuild,)) |
1391 |
+ out.eerror(_("A file listed in the Manifest " |
1392 |
+ "could not be found: '%s'") % (myebuild,)) |
1393 |
_doebuild_broken_ebuilds.add(myebuild) |
1394 |
return 1 |
1395 |
except portage.exception.DigestException, e: |
1396 |
out = portage.output.EOutput() |
1397 |
- out.eerror("Digest verification failed:") |
1398 |
+ out.eerror(_("Digest verification failed:")) |
1399 |
out.eerror("%s" % e.value[0]) |
1400 |
- out.eerror("Reason: %s" % e.value[1]) |
1401 |
- out.eerror("Got: %s" % e.value[2]) |
1402 |
- out.eerror("Expected: %s" % e.value[3]) |
1403 |
+ out.eerror(_("Reason: %s") % e.value[1]) |
1404 |
+ out.eerror(_("Got: %s") % e.value[2]) |
1405 |
+ out.eerror(_("Expected: %s") % e.value[3]) |
1406 |
_doebuild_broken_ebuilds.add(myebuild) |
1407 |
return 1 |
1408 |
|
1409 |
@@ -6552,8 +6519,8 @@ |
1410 |
f = os.path.join(pkgdir, f) |
1411 |
if f not in _doebuild_broken_ebuilds: |
1412 |
out = portage.output.EOutput() |
1413 |
- out.eerror("A file is not listed in the " + \ |
1414 |
- "Manifest: '%s'" % (f,)) |
1415 |
+ out.eerror(_("A file is not listed in the " |
1416 |
+ "Manifest: '%s'") % (f,)) |
1417 |
_doebuild_broken_manifests.add(manifest_path) |
1418 |
return 1 |
1419 |
|
1420 |
@@ -6672,11 +6639,10 @@ |
1421 |
|
1422 |
if "PORTAGE_TMPDIR" not in mysettings or \ |
1423 |
not os.path.isdir(mysettings["PORTAGE_TMPDIR"]): |
1424 |
- writemsg("The directory specified in your " + \ |
1425 |
- "PORTAGE_TMPDIR variable, '%s',\n" % \ |
1426 |
- mysettings.get("PORTAGE_TMPDIR", ""), noiselevel=-1) |
1427 |
- writemsg("does not exist. Please create this directory or " + \ |
1428 |
- "correct your PORTAGE_TMPDIR setting.\n", noiselevel=-1) |
1429 |
+ writemsg(_("The directory specified in your " |
1430 |
+ "PORTAGE_TMPDIR variable, '%s',\n" |
1431 |
+ "does not exist. Please create this directory or " |
1432 |
+ "correct your PORTAGE_TMPDIR setting.\n") % mysettings.get("PORTAGE_TMPDIR", ""), noiselevel=-1) |
1433 |
return 1 |
1434 |
|
1435 |
# as some people use a separate PORTAGE_TMPDIR mount |
1436 |
@@ -6688,20 +6654,20 @@ |
1437 |
checkdir = mysettings["PORTAGE_TMPDIR"] |
1438 |
|
1439 |
if not os.access(checkdir, os.W_OK): |
1440 |
- writemsg("%s is not writable.\n" % checkdir + \ |
1441 |
- "Likely cause is that you've mounted it as readonly.\n" \ |
1442 |
- , noiselevel=-1) |
1443 |
+ writemsg(_("%s is not writable.\n" |
1444 |
+ "Likely cause is that you've mounted it as readonly.\n") % checkdir, |
1445 |
+ noiselevel=-1) |
1446 |
return 1 |
1447 |
else: |
1448 |
from tempfile import NamedTemporaryFile |
1449 |
fd = NamedTemporaryFile(prefix="exectest-", dir=checkdir) |
1450 |
os.chmod(fd.name, 0755) |
1451 |
if not os.access(fd.name, os.X_OK): |
1452 |
- writemsg("Can not execute files in %s\n" % checkdir + \ |
1453 |
- "Likely cause is that you've mounted it with one of the\n" + \ |
1454 |
- "following mount options: 'noexec', 'user', 'users'\n\n" + \ |
1455 |
- "Please make sure that portage can execute files in this directory.\n" \ |
1456 |
- , noiselevel=-1) |
1457 |
+ writemsg(_("Can not execute files in %s\n" |
1458 |
+ "Likely cause is that you've mounted it with one of the\n" |
1459 |
+ "following mount options: 'noexec', 'user', 'users'\n\n" |
1460 |
+ "Please make sure that portage can execute files in this directory.\n") % checkdir, |
1461 |
+ noiselevel=-1) |
1462 |
fd.close() |
1463 |
return 1 |
1464 |
fd.close() |
1465 |
@@ -6764,7 +6730,7 @@ |
1466 |
# would be preserved between normal phases. |
1467 |
open(_unicode_encode(env_file + '.raw'), 'w') |
1468 |
else: |
1469 |
- writemsg(("!!! Error extracting saved " + \ |
1470 |
+ writemsg(_("!!! Error extracting saved " |
1471 |
"environment: '%s'\n") % \ |
1472 |
saved_env, noiselevel=-1) |
1473 |
try: |
1474 |
@@ -6781,11 +6747,11 @@ |
1475 |
value = mysettings.get(var) |
1476 |
if value and value.strip(): |
1477 |
continue |
1478 |
- msg = ("%s is not set... " % var) + \ |
1479 |
- ("Are you missing the '%setc/make.profile' symlink? " % \ |
1480 |
- mysettings["PORTAGE_CONFIGROOT"]) + \ |
1481 |
- "Is the symlink correct? " + \ |
1482 |
- "Is your portage tree complete?" |
1483 |
+ msg = _("%(var)s is not set... " |
1484 |
+ "Are you missing the '%(configroot)setc/make.profile' symlink? " |
1485 |
+ "Is the symlink correct? " |
1486 |
+ "Is your portage tree complete?") % \ |
1487 |
+ {"var": var, "configroot": mysettings["PORTAGE_CONFIGROOT"]} |
1488 |
from portage.elog.messages import eerror |
1489 |
from textwrap import wrap |
1490 |
for line in wrap(msg, 70): |
1491 |
@@ -6838,7 +6804,7 @@ |
1492 |
mysettings, debug=debug, free=1, logfile=logfile) |
1493 |
phase_retval = exit_status_check(phase_retval) |
1494 |
if phase_retval != os.EX_OK: |
1495 |
- writemsg("!!! post preinst failed; exiting.\n", |
1496 |
+ writemsg(_("!!! post preinst failed; exiting.\n"), |
1497 |
noiselevel=-1) |
1498 |
return phase_retval |
1499 |
elif mydo == "postinst": |
1500 |
@@ -6859,7 +6825,7 @@ |
1501 |
mysettings, debug=debug, free=1, logfile=logfile) |
1502 |
phase_retval = exit_status_check(phase_retval) |
1503 |
if phase_retval != os.EX_OK: |
1504 |
- writemsg("!!! post postinst failed; exiting.\n", |
1505 |
+ writemsg(_("!!! post postinst failed; exiting.\n"), |
1506 |
noiselevel=-1) |
1507 |
return phase_retval |
1508 |
elif mydo in ("prerm", "postrm", "config", "info"): |
1509 |
@@ -6897,7 +6863,7 @@ |
1510 |
aalist = mydbapi.getFetchMap(mycpv, mytree=mytree) |
1511 |
except portage.exception.InvalidDependString, e: |
1512 |
writemsg("!!! %s\n" % str(e), noiselevel=-1) |
1513 |
- writemsg("!!! Invalid SRC_URI for '%s'.\n" % mycpv, |
1514 |
+ writemsg(_("!!! Invalid SRC_URI for '%s'.\n") % mycpv, |
1515 |
noiselevel=-1) |
1516 |
del e |
1517 |
return 1 |
1518 |
@@ -6941,7 +6907,7 @@ |
1519 |
# and it can interfere with parallel tasks. |
1520 |
digestgen(aalist, mysettings, overwrite=0, myportdb=mydbapi) |
1521 |
except portage.exception.PermissionDenied, e: |
1522 |
- writemsg("!!! Permission Denied: %s\n" % (e,), noiselevel=-1) |
1523 |
+ writemsg(_("!!! Permission Denied: %s\n") % (e,), noiselevel=-1) |
1524 |
if mydo in ("digest", "manifest"): |
1525 |
return 1 |
1526 |
|
1527 |
@@ -7049,7 +7015,7 @@ |
1528 |
# forget it and are using ebuild |
1529 |
if not os.path.exists( |
1530 |
os.path.join(mysettings["PORTAGE_BUILDDIR"], ".installed")): |
1531 |
- writemsg("!!! mydo=qmerge, but the install phase has not been run\n", |
1532 |
+ writemsg(_("!!! mydo=qmerge, but the install phase has not been run\n"), |
1533 |
noiselevel=-1) |
1534 |
return 1 |
1535 |
# qmerge is a special phase that implies noclean. |
1536 |
@@ -7079,7 +7045,7 @@ |
1537 |
myebuild=mysettings["EBUILD"], mytree=tree, mydbapi=mydbapi, |
1538 |
vartree=vartree, prev_mtimes=prev_mtimes) |
1539 |
else: |
1540 |
- print "!!! Unknown mydo:",mydo |
1541 |
+ print _("!!! Unknown mydo: %s") % mydo |
1542 |
return 1 |
1543 |
|
1544 |
return retval |
1545 |
@@ -7144,10 +7110,10 @@ |
1546 |
k, metadata[k], str(e))) |
1547 |
|
1548 |
if not metadata["SLOT"]: |
1549 |
- msgs.append(" SLOT is undefined\n") |
1550 |
+ msgs.append(_(" SLOT is undefined\n")) |
1551 |
|
1552 |
if msgs: |
1553 |
- portage.util.writemsg_level("Error(s) in metadata for '%s':\n" % \ |
1554 |
+ portage.util.writemsg_level(_("Error(s) in metadata for '%s':\n") % \ |
1555 |
(mysettings.mycpv,), level=logging.ERROR, noiselevel=-1) |
1556 |
for x in msgs: |
1557 |
portage.util.writemsg_level(x, |
1558 |
@@ -7192,7 +7158,7 @@ |
1559 |
except SystemExit, e: |
1560 |
raise |
1561 |
except Exception, e: |
1562 |
- print "!!! Stating source file failed... movefile()" |
1563 |
+ print _("!!! Stating source file failed... movefile()") |
1564 |
print "!!!",e |
1565 |
return None |
1566 |
|
1567 |
@@ -7241,7 +7207,7 @@ |
1568 |
except SystemExit, e: |
1569 |
raise |
1570 |
except Exception, e: |
1571 |
- print "!!! failed to properly create symlink:" |
1572 |
+ print _("!!! failed to properly create symlink:") |
1573 |
print "!!!",dest,"->",target |
1574 |
print "!!!",e |
1575 |
return None |
1576 |
@@ -7259,7 +7225,7 @@ |
1577 |
os.unlink(hardlink_tmp) |
1578 |
except OSError, e: |
1579 |
if e.errno != errno.ENOENT: |
1580 |
- writemsg("!!! Failed to remove hardlink temp file: %s\n" % \ |
1581 |
+ writemsg(_("!!! Failed to remove hardlink temp file: %s\n") % \ |
1582 |
(hardlink_tmp,), noiselevel=-1) |
1583 |
writemsg("!!! %s\n" % (e,), noiselevel=-1) |
1584 |
return None |
1585 |
@@ -7273,7 +7239,7 @@ |
1586 |
try: |
1587 |
os.rename(hardlink_tmp, dest) |
1588 |
except OSError, e: |
1589 |
- writemsg("!!! Failed to rename %s to %s\n" % \ |
1590 |
+ writemsg(_("!!! Failed to rename %s to %s\n") % \ |
1591 |
(hardlink_tmp, dest), noiselevel=-1) |
1592 |
writemsg("!!! %s\n" % (e,), noiselevel=-1) |
1593 |
return None |
1594 |
@@ -7295,7 +7261,7 @@ |
1595 |
except Exception, e: |
1596 |
if e[0]!=errno.EXDEV: |
1597 |
# Some random error. |
1598 |
- print "!!! Failed to move",src,"to",dest |
1599 |
+ print _("!!! Failed to move %(src)s to %(dest)s") % {"src": src, "dest": dest} |
1600 |
print "!!!",e |
1601 |
return None |
1602 |
# Invalid cross-device-link 'bind' mounted or actually Cross-Device |
1603 |
@@ -7313,16 +7279,17 @@ |
1604 |
except SystemExit, e: |
1605 |
raise |
1606 |
except Exception, e: |
1607 |
- print '!!! copy',src,'->',dest,'failed.' |
1608 |
+ print _('!!! copy %(src)s -> %(dest)s failed.') % {"src": src, "dest": dest} |
1609 |
print "!!!",e |
1610 |
return None |
1611 |
else: |
1612 |
#we don't yet handle special, so we need to fall back to /bin/mv |
1613 |
- a = commands.getstatusoutput("%s -f %s %s" % \ |
1614 |
- (MOVE_BINARY, _shell_quote(src), _shell_quote(dest))) |
1615 |
- if a[0] != os.EX_OK: |
1616 |
- writemsg("!!! Failed to move special file:\n", noiselevel=-1) |
1617 |
- writemsg("!!! '%s' to '%s'\n" % (src, dest), noiselevel=-1) |
1618 |
+ a = process.spawn([MOVE_BINARY, '-f', src, dest], env=os.environ) |
1619 |
+ if a != os.EX_OK: |
1620 |
+ writemsg(_("!!! Failed to move special file:\n"), noiselevel=-1) |
1621 |
+ writemsg(_("!!! '%(src)s' to '%(dest)s'\n") % \ |
1622 |
+ {"src": _unicode_decode(src, encoding=encoding), |
1623 |
+ "dest": _unicode_decode(dest, encoding=encoding)}, noiselevel=-1) |
1624 |
writemsg("!!! %s\n" % a, noiselevel=-1) |
1625 |
return None # failure |
1626 |
try: |
1627 |
@@ -7336,7 +7303,7 @@ |
1628 |
except SystemExit, e: |
1629 |
raise |
1630 |
except Exception, e: |
1631 |
- print "!!! Failed to chown/chmod/unlink in movefile()" |
1632 |
+ print _("!!! Failed to chown/chmod/unlink in movefile()") |
1633 |
print "!!!",dest |
1634 |
print "!!!",e |
1635 |
return None |
1636 |
@@ -7356,7 +7323,7 @@ |
1637 |
try: |
1638 |
newmtime = long(os.stat(dest).st_mtime) |
1639 |
except OSError, e: |
1640 |
- writemsg("!!! Failed to stat in movefile()\n", noiselevel=-1) |
1641 |
+ writemsg(_("!!! Failed to stat in movefile()\n"), noiselevel=-1) |
1642 |
writemsg("!!! %s\n" % dest, noiselevel=-1) |
1643 |
writemsg("!!! %s\n" % str(e), noiselevel=-1) |
1644 |
return None |
1645 |
@@ -7372,7 +7339,7 @@ |
1646 |
mytree=None, mydbapi=None, vartree=None, prev_mtimes=None, blockers=None, |
1647 |
scheduler=None): |
1648 |
if not os.access(myroot + EPREFIX_LSTRIP, os.W_OK): |
1649 |
- writemsg("Permission denied: access('%s', W_OK)\n" % |
1650 |
+ writemsg(_("Permission denied: access('%s', W_OK)\n") % |
1651 |
(myroot + EPREFIX_LSTRIP), noiselevel=-1) |
1652 |
return errno.EACCES |
1653 |
mylink = dblink(mycat, mypkg, myroot, mysettings, treetype=mytree, |
1654 |
@@ -7472,16 +7439,16 @@ |
1655 |
except portage.exception.InvalidAtom: |
1656 |
if portage.dep._dep_check_strict: |
1657 |
raise portage.exception.ParseError( |
1658 |
- "invalid atom: '%s'" % x) |
1659 |
+ _("invalid atom: '%s'") % x) |
1660 |
else: |
1661 |
if x.blocker and x.blocker.overlap.forbid and \ |
1662 |
eapi in ("0", "1") and portage.dep._dep_check_strict: |
1663 |
raise portage.exception.ParseError( |
1664 |
- "invalid atom: '%s'" % (x,)) |
1665 |
+ _("invalid atom: '%s'") % (x,)) |
1666 |
if x.use and eapi in ("0", "1") and \ |
1667 |
portage.dep._dep_check_strict: |
1668 |
raise portage.exception.ParseError( |
1669 |
- "invalid atom: '%s'" % (x,)) |
1670 |
+ _("invalid atom: '%s'") % (x,)) |
1671 |
|
1672 |
if repoman and x.use and x.use.conditional: |
1673 |
evaluated_atom = portage.dep.remove_slot(x) |
1674 |
@@ -7542,8 +7509,8 @@ |
1675 |
use_split = db.aux_get(cpv, ["USE"])[0].split() |
1676 |
pkg_kwargs["myuse"] = use_split |
1677 |
if edebug: |
1678 |
- print "Virtual Parent: ", y[0] |
1679 |
- print "Virtual Depstring:", depstring |
1680 |
+ print _("Virtual Parent: "), y[0] |
1681 |
+ print _("Virtual Depstring:"), depstring |
1682 |
|
1683 |
# Set EAPI used for validation in dep_check() recursion. |
1684 |
virtual_eapi, = db.aux_get(cpv, ["EAPI"]) |
1685 |
@@ -7879,7 +7846,7 @@ |
1686 |
mysplit2=mysplit[:] |
1687 |
mysplit2=dep_wordreduce(mysplit2,mysettings,mydbapi,mode,use_cache=use_cache) |
1688 |
if mysplit2 is None: |
1689 |
- return [0,"Invalid token"] |
1690 |
+ return [0, _("Invalid token")] |
1691 |
|
1692 |
writemsg("\n\n\n", 1) |
1693 |
writemsg("mysplit: %s\n" % (mysplit), 1) |
1694 |
@@ -7893,7 +7860,7 @@ |
1695 |
raise # This shouldn't happen. |
1696 |
# dbapi.match() failed due to an invalid atom in |
1697 |
# the dependencies of an installed package. |
1698 |
- return [0, "Invalid atom: '%s'" % (e,)] |
1699 |
+ return [0, _("Invalid atom: '%s'") % (e,)] |
1700 |
|
1701 |
mylist = flatten(myzaps) |
1702 |
writemsg("myzaps: %s\n" % (myzaps), 1) |
1703 |
@@ -8014,11 +7981,11 @@ |
1704 |
# dbapi.cp_list(). |
1705 |
if mydb.cp_list(dep_getkey(vkey), use_cache=use_cache): |
1706 |
mykey = vkey |
1707 |
- writemsg("virts chosen: %s\n" % (mykey), 1) |
1708 |
+ writemsg(_("virts chosen: %s\n") % (mykey), 1) |
1709 |
break |
1710 |
if mykey == mykey_orig: |
1711 |
mykey=virts[mykey][0] |
1712 |
- writemsg("virts defaulted: %s\n" % (mykey), 1) |
1713 |
+ writemsg(_("virts defaulted: %s\n") % (mykey), 1) |
1714 |
#we only perform virtual expansion if we are passed a dbapi |
1715 |
else: |
1716 |
#specific cpv, no category, ie. "foo-1.0" |
1717 |
@@ -8075,7 +8042,7 @@ |
1718 |
portdb = globals()["portdb"] |
1719 |
mysplit = catpkgsplit(mycpv) |
1720 |
if not mysplit: |
1721 |
- raise ValueError("invalid CPV: %s" % mycpv) |
1722 |
+ raise ValueError(_("invalid CPV: %s") % mycpv) |
1723 |
if metadata is None: |
1724 |
db_keys = list(portdb._aux_cache_keys) |
1725 |
try: |
1726 |
@@ -8151,7 +8118,7 @@ |
1727 |
|
1728 |
mysplit = catpkgsplit(mycpv) |
1729 |
if not mysplit: |
1730 |
- raise ValueError("invalid CPV: %s" % mycpv) |
1731 |
+ raise ValueError(_("invalid CPV: %s") % mycpv) |
1732 |
if metadata is None: |
1733 |
db_keys = list(portdb._aux_cache_keys) |
1734 |
try: |
1735 |
@@ -8270,7 +8237,7 @@ |
1736 |
msg.append("properties") |
1737 |
rValue.append(" ".join(msg)) |
1738 |
except portage.exception.InvalidDependString, e: |
1739 |
- rValue.append("PROPERTIES: "+srt(e)) |
1740 |
+ rValue.append("PROPERTIES: "+str(e)) |
1741 |
|
1742 |
# Only show KEYWORDS masks for installed packages |
1743 |
# if they're not masked for any other reason. |
1744 |
@@ -8338,7 +8305,7 @@ |
1745 |
if vartree is None: |
1746 |
vartree = db[myroot]["vartree"] |
1747 |
if mytbz2[-5:]!=".tbz2": |
1748 |
- print "!!! Not a .tbz2 file" |
1749 |
+ print _("!!! Not a .tbz2 file") |
1750 |
return 1 |
1751 |
|
1752 |
tbz2_lock = None |
1753 |
@@ -8355,7 +8322,7 @@ |
1754 |
xptbz2 = portage.xpak.tbz2(mytbz2) |
1755 |
mycat = xptbz2.getfile("CATEGORY") |
1756 |
if not mycat: |
1757 |
- writemsg("!!! CATEGORY info missing from info chunk, aborting...\n", |
1758 |
+ writemsg(_("!!! CATEGORY info missing from info chunk, aborting...\n"), |
1759 |
noiselevel=-1) |
1760 |
return 1 |
1761 |
mycat = mycat.strip() |
1762 |
@@ -8393,7 +8360,7 @@ |
1763 |
for mydir in (builddir, pkgloc, infloc): |
1764 |
portage.util.ensure_dirs(mydir, uid=portage_uid, |
1765 |
gid=portage_gid, mode=0755) |
1766 |
- writemsg_stdout(">>> Extracting info\n") |
1767 |
+ writemsg_stdout(_(">>> Extracting info\n")) |
1768 |
xptbz2.unpackinfo(infloc) |
1769 |
mysettings.setcpv(mycat + "/" + mypkg, mydb=mydbapi) |
1770 |
# Store the md5sum in the vdb. |
1771 |
@@ -8418,15 +8385,15 @@ |
1772 |
retval = doebuild(myebuild, "setup", myroot, mysettings, debug=debug, |
1773 |
tree="bintree", mydbapi=mydbapi, vartree=vartree) |
1774 |
if retval != os.EX_OK: |
1775 |
- writemsg("!!! Setup failed: %s\n" % retval, noiselevel=-1) |
1776 |
+ writemsg(_("!!! Setup failed: %s\n") % retval, noiselevel=-1) |
1777 |
return retval |
1778 |
|
1779 |
- writemsg_stdout(">>> Extracting %s\n" % mypkg) |
1780 |
+ writemsg_stdout(_(">>> Extracting %s\n") % mypkg) |
1781 |
retval = portage.process.spawn_bash( |
1782 |
"bzip2 -dqc -- '%s' | tar -xp -C '%s' -f -" % (mytbz2, pkgloc), |
1783 |
env=mysettings.environ()) |
1784 |
if retval != os.EX_OK: |
1785 |
- writemsg("!!! Error Extracting '%s'\n" % mytbz2, noiselevel=-1) |
1786 |
+ writemsg(_("!!! Error Extracting '%s'\n") % mytbz2, noiselevel=-1) |
1787 |
return retval |
1788 |
#portage.locks.unlockfile(tbz2_lock) |
1789 |
#tbz2_lock = None |
1790 |
@@ -8486,18 +8453,18 @@ |
1791 |
return False |
1792 |
dcontent = codecs.open(_unicode_encode(deprecated_profile_file), |
1793 |
mode='r', encoding='utf_8', errors='replace').readlines() |
1794 |
- writemsg(colorize("BAD", "\n!!! Your current profile is " + \ |
1795 |
- "deprecated and not supported anymore.") + "\n", noiselevel=-1) |
1796 |
+ writemsg(colorize("BAD", _("\n!!! Your current profile is " |
1797 |
+ "deprecated and not supported anymore.")) + "\n", noiselevel=-1) |
1798 |
if not dcontent: |
1799 |
- writemsg(colorize("BAD","!!! Please refer to the " + \ |
1800 |
- "Gentoo Upgrading Guide.") + "\n", noiselevel=-1) |
1801 |
+ writemsg(colorize("BAD", _("!!! Please refer to the " |
1802 |
+ "Gentoo Upgrading Guide.")) + "\n", noiselevel=-1) |
1803 |
return True |
1804 |
newprofile = dcontent[0] |
1805 |
- writemsg(colorize("BAD", "!!! Please upgrade to the " + \ |
1806 |
- "following profile if possible:") + "\n", noiselevel=-1) |
1807 |
+ writemsg(colorize("BAD", _("!!! Please upgrade to the " |
1808 |
+ "following profile if possible:")) + "\n", noiselevel=-1) |
1809 |
writemsg(8*" " + colorize("GOOD", newprofile) + "\n", noiselevel=-1) |
1810 |
if len(dcontent) > 1: |
1811 |
- writemsg("To upgrade do the following steps:\n", noiselevel=-1) |
1812 |
+ writemsg(_("To upgrade do the following steps:\n"), noiselevel=-1) |
1813 |
for myline in dcontent[1:]: |
1814 |
writemsg(myline, noiselevel=-1) |
1815 |
writemsg("\n\n", noiselevel=-1) |
1816 |
@@ -8566,8 +8533,8 @@ |
1817 |
else: |
1818 |
update_data = grab_updates(updpath, prev_mtimes) |
1819 |
except portage.exception.DirectoryNotFound: |
1820 |
- writemsg("--- 'profiles/updates' is empty or " + \ |
1821 |
- "not available. Empty portage tree?\n", noiselevel=1) |
1822 |
+ writemsg(_("--- 'profiles/updates' is empty or " |
1823 |
+ "not available. Empty portage tree?\n"), noiselevel=1) |
1824 |
return |
1825 |
myupd = None |
1826 |
if len(update_data) > 0: |
1827 |
@@ -8577,15 +8544,13 @@ |
1828 |
for mykey, mystat, mycontent in update_data: |
1829 |
writemsg_stdout("\n\n") |
1830 |
writemsg_stdout(colorize("GOOD", |
1831 |
- "Performing Global Updates: ")+bold(mykey)+"\n") |
1832 |
- writemsg_stdout("(Could take a couple of minutes if you have a lot of binary packages.)\n") |
1833 |
- writemsg_stdout(" " + bold(".") + "='update pass' " + \ |
1834 |
- bold("*") + "='binary update' " + bold("#") + \ |
1835 |
- "='/var/db update' " + bold("@") + "='/var/db move'\n" + \ |
1836 |
- " " + bold("s") + "='/var/db SLOT move' " + \ |
1837 |
- bold("%") + "='binary move' " + bold("S") + \ |
1838 |
- "='binary SLOT move'\n " + \ |
1839 |
- bold("p") + "='update /etc/portage/package.*'\n") |
1840 |
+ _("Performing Global Updates: "))+bold(mykey)+"\n") |
1841 |
+ writemsg_stdout(_("(Could take a couple of minutes if you have a lot of binary packages.)\n")) |
1842 |
+ writemsg_stdout(_(" %s='update pass' %s='binary update' " |
1843 |
+ "%s='/var/db update' %s='/var/db move'\n" |
1844 |
+ " %s='/var/db SLOT move' %s='binary move' " |
1845 |
+ "%s='binary SLOT move'\n %s='update /etc/portage/package.*'\n") % \ |
1846 |
+ (bold("."), bold("*"), bold("#"), bold("@"), bold("s"), bold("%"), bold("S"), bold("p"))) |
1847 |
valid_updates, errors = parse_updates(mycontent) |
1848 |
myupd.extend(valid_updates) |
1849 |
writemsg_stdout(len(valid_updates) * "." + "\n") |
1850 |
@@ -8673,8 +8638,8 @@ |
1851 |
|
1852 |
if do_upgrade_packagesmessage and bindb and \ |
1853 |
bindb.cpv_all(): |
1854 |
- writemsg_stdout(" ** Skipping packages. Run 'fixpackages' or set it in FEATURES to fix the") |
1855 |
- writemsg_stdout("\n tbz2's in the packages directory. "+bold("Note: This can take a very long time.")) |
1856 |
+ writemsg_stdout(_(" ** Skipping packages. Run 'fixpackages' or set it in FEATURES to fix the tbz2's in the packages directory.\n")) |
1857 |
+ writemsg_stdout(bold(_("Note: This can take a very long time."))) |
1858 |
writemsg_stdout("\n") |
1859 |
if myupd: |
1860 |
return myupd |
1861 |
@@ -8701,7 +8666,7 @@ |
1862 |
del f |
1863 |
except (IOError, OSError, EOFError, ValueError, pickle.UnpicklingError), e: |
1864 |
if isinstance(e, pickle.UnpicklingError): |
1865 |
- writemsg("!!! Error loading '%s': %s\n" % \ |
1866 |
+ writemsg(_("!!! Error loading '%s': %s\n") % \ |
1867 |
(filename, str(e)), noiselevel=-1) |
1868 |
del e |
1869 |
d = {} |
1870 |
@@ -8722,7 +8687,7 @@ |
1871 |
|
1872 |
for k in d.keys(): |
1873 |
if k not in mtimedbkeys: |
1874 |
- writemsg("Deleting invalid mtimedb key: %s\n" % str(k)) |
1875 |
+ writemsg(_("Deleting invalid mtimedb key: %s\n") % str(k)) |
1876 |
del d[k] |
1877 |
self.update(d) |
1878 |
self._clean_data = copy.deepcopy(d) |
1879 |
|
1880 |
Modified: main/branches/prefix/pym/portage/_selinux.py |
1881 |
=================================================================== |
1882 |
--- main/branches/prefix/pym/portage/_selinux.py 2009-08-24 09:20:57 UTC (rev 14136) |
1883 |
+++ main/branches/prefix/pym/portage/_selinux.py 2009-08-24 09:27:07 UTC (rev 14137) |
1884 |
@@ -8,6 +8,8 @@ |
1885 |
import shutil |
1886 |
|
1887 |
import portage |
1888 |
+from portage.localization import _ |
1889 |
+ |
1890 |
import selinux |
1891 |
from selinux import is_selinux_enabled, getfilecon, lgetfilecon |
1892 |
|
1893 |
@@ -16,7 +18,7 @@ |
1894 |
dest = portage._unicode_encode(dest) |
1895 |
(rc, ctx) = selinux.lgetfilecon(src) |
1896 |
if rc < 0: |
1897 |
- raise OSError("copyfile: Failed getting context of \"%s\"." % src) |
1898 |
+ raise OSError(_("copyfile: Failed getting context of \"%s\".") % src) |
1899 |
|
1900 |
setfscreate(ctx) |
1901 |
try: |
1902 |
@@ -27,7 +29,7 @@ |
1903 |
def getcontext(): |
1904 |
(rc, ctx) = selinux.getcon() |
1905 |
if rc < 0: |
1906 |
- raise OSError("getcontext: Failed getting current process context.") |
1907 |
+ raise OSError(_("getcontext: Failed getting current process context.")) |
1908 |
|
1909 |
return ctx |
1910 |
|
1911 |
@@ -37,7 +39,7 @@ |
1912 |
(rc, ctx) = selinux.getfilecon(refdir) |
1913 |
if rc < 0: |
1914 |
raise OSError( |
1915 |
- "mkdir: Failed getting context of reference directory \"%s\"." \ |
1916 |
+ _("mkdir: Failed getting context of reference directory \"%s\".") \ |
1917 |
% refdir) |
1918 |
|
1919 |
setfscreatecon(ctx) |
1920 |
@@ -51,7 +53,7 @@ |
1921 |
dest = portage._unicode_encode(dest) |
1922 |
(rc, ctx) = selinux.lgetfilecon(src) |
1923 |
if rc < 0: |
1924 |
- raise OSError("rename: Failed getting context of \"%s\"." % src) |
1925 |
+ raise OSError(_("rename: Failed getting context of \"%s\".") % src) |
1926 |
|
1927 |
setfscreate(ctx) |
1928 |
try: |
1929 |
@@ -68,13 +70,13 @@ |
1930 |
if isinstance(ctx, unicode): |
1931 |
ctx = ctx.encode('utf_8', 'replace') |
1932 |
if selinux.setexeccon(ctx) < 0: |
1933 |
- raise OSError("setexec: Failed setting exec() context \"%s\"." % ctx) |
1934 |
+ raise OSError(_("setexec: Failed setting exec() context \"%s\".") % ctx) |
1935 |
|
1936 |
def setfscreate(ctx="\n"): |
1937 |
ctx = portage._unicode_encode(ctx) |
1938 |
if selinux.setfscreatecon(ctx) < 0: |
1939 |
raise OSError( |
1940 |
- "setfscreate: Failed setting fs create context \"%s\"." % ctx) |
1941 |
+ _("setfscreate: Failed setting fs create context \"%s\".") % ctx) |
1942 |
|
1943 |
def spawn_wrapper(spawn_func, selinux_type): |
1944 |
|
1945 |
@@ -96,7 +98,7 @@ |
1946 |
(rc, ctx) = selinux.lgetfilecon(reflnk) |
1947 |
if rc < 0: |
1948 |
raise OSError( |
1949 |
- "symlink: Failed getting context of reference symlink \"%s\"." \ |
1950 |
+ _("symlink: Failed getting context of reference symlink \"%s\".") \ |
1951 |
% reflnk) |
1952 |
|
1953 |
setfscreate(ctx) |
1954 |
|
1955 |
Modified: main/branches/prefix/pym/portage/checksum.py |
1956 |
=================================================================== |
1957 |
--- main/branches/prefix/pym/portage/checksum.py 2009-08-24 09:20:57 UTC (rev 14136) |
1958 |
+++ main/branches/prefix/pym/portage/checksum.py 2009-08-24 09:27:07 UTC (rev 14137) |
1959 |
@@ -5,7 +5,9 @@ |
1960 |
|
1961 |
import portage |
1962 |
from portage.const import PRIVATE_PATH,PRELINK_BINARY,HASHING_BLOCKSIZE |
1963 |
+from portage.localization import _ |
1964 |
from portage import os |
1965 |
+from portage import _fs_encoding |
1966 |
from portage import _merge_encoding |
1967 |
from portage import _unicode_encode |
1968 |
import errno |
1969 |
@@ -26,7 +28,8 @@ |
1970 |
@type filename: String |
1971 |
@return: The hash and size of the data |
1972 |
""" |
1973 |
- f = open(_unicode_encode(filename), 'rb') |
1974 |
+ f = open(_unicode_encode(filename, |
1975 |
+ encoding=_fs_encoding, errors='strict'), 'rb') |
1976 |
blocksize = HASHING_BLOCKSIZE |
1977 |
data = f.read(blocksize) |
1978 |
size = 0L |
1979 |
@@ -119,7 +122,8 @@ |
1980 |
return perform_checksum(x, "MD5", calc_prelink)[0] |
1981 |
|
1982 |
def _perform_md5_merge(x, **kwargs): |
1983 |
- return perform_md5(_unicode_encode(x, encoding=_merge_encoding), **kwargs) |
1984 |
+ return perform_md5(_unicode_encode(x, |
1985 |
+ encoding=_merge_encoding, errors='strict'), **kwargs) |
1986 |
|
1987 |
def perform_all(x, calc_prelink=0): |
1988 |
mydict = {} |
1989 |
@@ -159,7 +163,7 @@ |
1990 |
try: |
1991 |
mysize = os.stat(filename)[stat.ST_SIZE] |
1992 |
if mydict["size"] != mysize: |
1993 |
- return False,("Filesize does not match recorded size", mysize, mydict["size"]) |
1994 |
+ return False,(_("Filesize does not match recorded size"), mysize, mydict["size"]) |
1995 |
except OSError, e: |
1996 |
if e.errno == errno.ENOENT: |
1997 |
raise portage.exception.FileNotFound(filename) |
1998 |
@@ -178,7 +182,7 @@ |
1999 |
got = list(got) |
2000 |
got.sort() |
2001 |
got = " ".join(got) |
2002 |
- return False, ("Insufficient data for checksum verification", got, expected) |
2003 |
+ return False, (_("Insufficient data for checksum verification"), got, expected) |
2004 |
|
2005 |
for x in mydict: |
2006 |
if x == "size": |
2007 |
@@ -199,7 +203,10 @@ |
2008 |
|
2009 |
def perform_checksum(filename, hashname="MD5", calc_prelink=0): |
2010 |
""" |
2011 |
- Run a specific checksum against a file. |
2012 |
+ Run a specific checksum against a file. The filename can |
2013 |
+ be either unicode or an encoded byte string. If filename |
2014 |
+ is unicode then a UnicodeDecodeError will be raised if |
2015 |
+ necessary. |
2016 |
|
2017 |
@param filename: File to run the checksum against |
2018 |
@type filename: String |
2019 |
@@ -211,7 +218,11 @@ |
2020 |
@return: The hash and size of the data |
2021 |
""" |
2022 |
global prelink_capable |
2023 |
- myfilename = filename[:] |
2024 |
+ # Make sure filename is encoded with the correct encoding before |
2025 |
+ # it is passed to spawn (for prelink) and/or the hash function. |
2026 |
+ filename = _unicode_encode(filename, |
2027 |
+ encoding=_fs_encoding, errors='strict') |
2028 |
+ myfilename = filename |
2029 |
prelink_tmpfile = None |
2030 |
try: |
2031 |
if calc_prelink and prelink_capable: |
2032 |
|
2033 |
Modified: main/branches/prefix/pym/portage/data.py |
2034 |
=================================================================== |
2035 |
--- main/branches/prefix/pym/portage/data.py 2009-08-24 09:20:57 UTC (rev 14136) |
2036 |
+++ main/branches/prefix/pym/portage/data.py 2009-08-24 09:27:07 UTC (rev 14137) |
2037 |
@@ -11,6 +11,7 @@ |
2038 |
'portage.output:colorize', |
2039 |
'portage.util:writemsg', |
2040 |
) |
2041 |
+from portage.localization import _ |
2042 |
|
2043 |
ostype=platform.system() |
2044 |
userland = None |
2045 |
@@ -34,9 +35,9 @@ |
2046 |
lchown = missingos.lchown |
2047 |
except ImportError: |
2048 |
def lchown(*pos_args, **key_args): |
2049 |
- writemsg(colorize("BAD", "!!!") + \ |
2050 |
- " It seems that os.lchown does not" + \ |
2051 |
- " exist. Please rebuild python.\n", noiselevel=-1) |
2052 |
+ writemsg(colorize("BAD", "!!!") + _( |
2053 |
+ " It seems that os.lchown does not" |
2054 |
+ " exist. Please rebuild python.\n"), noiselevel=-1) |
2055 |
lchown() |
2056 |
|
2057 |
lchown = portage._unicode_func_wrapper(lchown) |
2058 |
@@ -88,6 +89,7 @@ |
2059 |
portage_uid=0 |
2060 |
portage_gid=0 |
2061 |
writemsg("\n") |
2062 |
+ # warning: not localised |
2063 |
writemsg(colorize("BAD", |
2064 |
"portage: "+portageuser+" user or "+portagegroup+" group missing.") + "\n", noiselevel=-1) |
2065 |
writemsg(colorize("BAD", |
2066 |
@@ -96,13 +98,11 @@ |
2067 |
" since it means you have thrown away yourself.") + "\n", noiselevel=-1) |
2068 |
writemsg(colorize("BAD", |
2069 |
" Re-add yourself or re-bootstrap Gentoo Prefix.") + "\n", noiselevel=-1) |
2070 |
- writemsg("\n") |
2071 |
# we need to fix this one day to distinguish prefix vs non-prefix |
2072 |
-# writemsg(colorize("BAD", |
2073 |
-# "portage: 'portage' user or group missing.") + "\n", noiselevel=-1) |
2074 |
-# writemsg( |
2075 |
-# " For the defaults, line 1 goes into passwd, " + \ |
2076 |
-# "and 2 into group.\n", noiselevel=-1) |
2077 |
+# _("portage: 'portage' user or group missing.")) + "\n", noiselevel=-1) |
2078 |
+# writemsg(_( |
2079 |
+# " For the defaults, line 1 goes into passwd, " |
2080 |
+# "and 2 into group.\n"), noiselevel=-1) |
2081 |
# writemsg(colorize("GOOD", |
2082 |
# " portage:x:250:250:portage:/var/tmp/portage:/bin/false") \ |
2083 |
# + "\n", noiselevel=-1) |
2084 |
|
2085 |
Modified: main/branches/prefix/pym/portage/dbapi/vartree.py |
2086 |
=================================================================== |
2087 |
--- main/branches/prefix/pym/portage/dbapi/vartree.py 2009-08-24 09:20:57 UTC (rev 14136) |
2088 |
+++ main/branches/prefix/pym/portage/dbapi/vartree.py 2009-08-24 09:27:07 UTC (rev 14137) |
2089 |
@@ -2986,6 +2986,7 @@ |
2090 |
""" |
2091 |
|
2092 |
os = _os_merge |
2093 |
+ perf_md5 = perform_md5 |
2094 |
showMessage = self._display_merge |
2095 |
scheduler = self._scheduler |
2096 |
|
2097 |
@@ -3089,6 +3090,7 @@ |
2098 |
pass |
2099 |
else: |
2100 |
os = portage.os |
2101 |
+ perf_md5 = portage.checksum.perform_md5 |
2102 |
|
2103 |
file_data = pkgfiles[objkey] |
2104 |
file_type = file_data[0] |
2105 |
@@ -3179,7 +3181,7 @@ |
2106 |
continue |
2107 |
mymd5 = None |
2108 |
try: |
2109 |
- mymd5 = perform_md5(obj, calc_prelink=1) |
2110 |
+ mymd5 = perf_md5(obj, calc_prelink=1) |
2111 |
except FileNotFound, e: |
2112 |
# the file has disappeared between now and our stat call |
2113 |
show_unmerge("---", unmerge_desc["!obj"], file_type, obj) |
2114 |
|
2115 |
Modified: main/branches/prefix/pym/portage/dep.py |
2116 |
=================================================================== |
2117 |
--- main/branches/prefix/pym/portage/dep.py 2009-08-24 09:20:57 UTC (rev 14136) |
2118 |
+++ main/branches/prefix/pym/portage/dep.py 2009-08-24 09:27:07 UTC (rev 14137) |
2119 |
@@ -23,6 +23,7 @@ |
2120 |
from itertools import chain |
2121 |
import portage.exception |
2122 |
from portage.exception import InvalidData, InvalidAtom |
2123 |
+from portage.localization import _ |
2124 |
from portage.versions import catpkgsplit, catsplit, pkgcmp, pkgsplit, ververify |
2125 |
import portage.cache.mappings |
2126 |
|
2127 |
@@ -50,7 +51,7 @@ |
2128 |
split2 = catpkgsplit(cpv2) |
2129 |
|
2130 |
if not split1 or not split2: |
2131 |
- raise portage.exception.PortageException("Invalid data '%s, %s', parameter was not a CPV" % (cpv1, cpv2)) |
2132 |
+ raise portage.exception.PortageException(_("Invalid data '%s, %s', parameter was not a CPV") % (cpv1, cpv2)) |
2133 |
|
2134 |
if split1[0] != split2[0]: |
2135 |
return False |
2136 |
@@ -93,7 +94,7 @@ |
2137 |
m = _paren_whitespace_re.search(mystr) |
2138 |
if m is not None: |
2139 |
raise portage.exception.InvalidDependString( |
2140 |
- "missing space by parenthesis: '%s'" % m.group(0)) |
2141 |
+ _("missing space by parenthesis: '%s'") % m.group(0)) |
2142 |
mylist = [] |
2143 |
while mystr: |
2144 |
left_paren = mystr.find("(") |
2145 |
@@ -108,13 +109,13 @@ |
2146 |
return [mylist,mystr[1:]] |
2147 |
elif has_left_paren and not has_right_paren: |
2148 |
raise portage.exception.InvalidDependString( |
2149 |
- "missing right parenthesis: '%s'" % mystr) |
2150 |
+ _("missing right parenthesis: '%s'") % mystr) |
2151 |
elif has_left_paren and left_paren < right_paren: |
2152 |
freesec,subsec = mystr.split("(",1) |
2153 |
sublist = paren_reduce(subsec, tokenize=tokenize) |
2154 |
if len(sublist) != 2: |
2155 |
raise portage.exception.InvalidDependString( |
2156 |
- "malformed syntax: '%s'" % mystr) |
2157 |
+ _("malformed syntax: '%s'") % mystr) |
2158 |
subsec, tail = sublist |
2159 |
else: |
2160 |
subsec,tail = mystr.split(")",1) |
2161 |
@@ -124,7 +125,7 @@ |
2162 |
return mylist+[subsec],tail |
2163 |
if not isinstance(tail, basestring): |
2164 |
raise portage.exception.InvalidDependString( |
2165 |
- "malformed syntax: '%s'" % mystr) |
2166 |
+ _("malformed syntax: '%s'") % mystr) |
2167 |
mystr = tail |
2168 |
if freesec: |
2169 |
if tokenize: |
2170 |
@@ -219,9 +220,9 @@ |
2171 |
for x, y in enumerate(deparray): |
2172 |
if y == '||': |
2173 |
if len(deparray) - 1 == x or not isinstance(deparray[x+1], list): |
2174 |
- raise portage.exception.InvalidDependString(deparray[x]+" missing atom list in \""+paren_enclose(deparray)+"\"") |
2175 |
+ raise portage.exception.InvalidDependString(_('%(dep)s missing atom list in "%(deparray)s"') % {"dep": deparray[x], "deparray": paren_enclose(deparray)}) |
2176 |
if deparray and deparray[-1] and deparray[-1][-1] == "?": |
2177 |
- raise portage.exception.InvalidDependString("Conditional without target in \""+paren_enclose(deparray)+"\"") |
2178 |
+ raise portage.exception.InvalidDependString(_('Conditional without target in "%s"') % paren_enclose(deparray)) |
2179 |
|
2180 |
global _dep_check_strict |
2181 |
|
2182 |
@@ -248,15 +249,15 @@ |
2183 |
if mydeparray: |
2184 |
newdeparray.append(mydeparray.pop(0)) |
2185 |
else: |
2186 |
- raise ValueError("Conditional with no target.") |
2187 |
+ raise ValueError(_("Conditional with no target.")) |
2188 |
|
2189 |
# Deprecation checks |
2190 |
warned = 0 |
2191 |
if len(newdeparray[-1]) == 0: |
2192 |
- sys.stderr.write("Note: Empty target in string. (Deprecated)\n") |
2193 |
+ sys.stderr.write(_("Note: Empty target in string. (Deprecated)\n")) |
2194 |
warned = 1 |
2195 |
if len(newdeparray) != 2: |
2196 |
- sys.stderr.write("Note: Nested use flags without parenthesis (Deprecated)\n") |
2197 |
+ sys.stderr.write(_("Note: Nested use flags without parenthesis (Deprecated)\n")) |
2198 |
warned = 1 |
2199 |
if warned: |
2200 |
sys.stderr.write(" --> "+" ".join(map(str,[head]+newdeparray))+"\n") |
2201 |
@@ -286,7 +287,7 @@ |
2202 |
ismatch = False |
2203 |
if missing_flag: |
2204 |
raise portage.exception.InvalidDependString( |
2205 |
- "Conditional without flag: \"" + \ |
2206 |
+ _('Conditional without flag: "') + \ |
2207 |
paren_enclose([head+"?", newdeparray[-1]])+"\"") |
2208 |
|
2209 |
# If they all match, process the target |
2210 |
@@ -301,7 +302,7 @@ |
2211 |
rlist.append(target) |
2212 |
else: |
2213 |
raise portage.exception.InvalidDependString( |
2214 |
- "Conditional without parenthesis: '%s?'" % head) |
2215 |
+ _("Conditional without parenthesis: '%s?'") % head) |
2216 |
|
2217 |
else: |
2218 |
rlist += [head] |
2219 |
@@ -406,7 +407,7 @@ |
2220 |
|
2221 |
def _validate_flag(self, token, flag): |
2222 |
if self._valid_use_re.match(flag) is None: |
2223 |
- raise InvalidAtom("Invalid use dep: '%s'" % (token,)) |
2224 |
+ raise InvalidAtom(_("Invalid use dep: '%s'") % (token,)) |
2225 |
return flag |
2226 |
|
2227 |
def __nonzero__(self): |
2228 |
@@ -802,30 +803,30 @@ |
2229 |
while( open_bracket != -1 ): |
2230 |
bracket_count += 1 |
2231 |
if bracket_count > 1: |
2232 |
- raise InvalidAtom("USE Dependency with more " + \ |
2233 |
- "than one set of brackets: %s" % (depend,)) |
2234 |
+ raise InvalidAtom(_("USE Dependency with more " |
2235 |
+ "than one set of brackets: %s") % (depend,)) |
2236 |
close_bracket = depend.find(']', open_bracket ) |
2237 |
if close_bracket == -1: |
2238 |
- raise InvalidAtom("USE Dependency with no closing bracket: %s" % depend ) |
2239 |
+ raise InvalidAtom(_("USE Dependency with no closing bracket: %s") % depend ) |
2240 |
use = depend[open_bracket + 1: close_bracket] |
2241 |
# foo[1:1] may return '' instead of None, we don't want '' in the result |
2242 |
if not use: |
2243 |
- raise InvalidAtom("USE Dependency with " + \ |
2244 |
- "no use flag ([]): %s" % depend ) |
2245 |
+ raise InvalidAtom(_("USE Dependency with " |
2246 |
+ "no use flag ([]): %s") % depend ) |
2247 |
if not comma_separated: |
2248 |
comma_separated = "," in use |
2249 |
|
2250 |
if comma_separated and bracket_count > 1: |
2251 |
- raise InvalidAtom("USE Dependency contains a mixture of " + \ |
2252 |
- "comma and bracket separators: %s" % depend ) |
2253 |
+ raise InvalidAtom(_("USE Dependency contains a mixture of " |
2254 |
+ "comma and bracket separators: %s") % depend ) |
2255 |
|
2256 |
if comma_separated: |
2257 |
for x in use.split(","): |
2258 |
if x: |
2259 |
use_list.append(x) |
2260 |
else: |
2261 |
- raise InvalidAtom("USE Dependency with no use " + \ |
2262 |
- "flag next to comma: %s" % depend ) |
2263 |
+ raise InvalidAtom(_("USE Dependency with no use " |
2264 |
+ "flag next to comma: %s") % depend ) |
2265 |
else: |
2266 |
use_list.append(use) |
2267 |
|
2268 |
@@ -1088,13 +1089,13 @@ |
2269 |
else: |
2270 |
cat, pkg, ver, rev = mycpv_cps |
2271 |
if mydep == mycpv: |
2272 |
- raise KeyError("Specific key requires an operator" + \ |
2273 |
- " (%s) (try adding an '=')" % (mydep)) |
2274 |
+ raise KeyError(_("Specific key requires an operator" |
2275 |
+ " (%s) (try adding an '=')") % (mydep)) |
2276 |
|
2277 |
if ver and rev: |
2278 |
operator = get_operator(mydep) |
2279 |
if not operator: |
2280 |
- writemsg("!!! Invalid atom: %s\n" % mydep, noiselevel=-1) |
2281 |
+ writemsg(_("!!! Invalid atom: %s\n") % mydep, noiselevel=-1) |
2282 |
return [] |
2283 |
else: |
2284 |
operator = None |
2285 |
@@ -1163,7 +1164,7 @@ |
2286 |
try: |
2287 |
result = pkgcmp(xs, mysplit) |
2288 |
except ValueError: # pkgcmp may return ValueError during int() conversion |
2289 |
- writemsg("\nInvalid package name: %s\n" % x, noiselevel=-1) |
2290 |
+ writemsg(_("\nInvalid package name: %s\n") % x, noiselevel=-1) |
2291 |
raise |
2292 |
if result is None: |
2293 |
continue |
2294 |
@@ -1180,9 +1181,9 @@ |
2295 |
if result <= 0: |
2296 |
mylist.append(x) |
2297 |
else: |
2298 |
- raise KeyError("Unknown operator: %s" % mydep) |
2299 |
+ raise KeyError(_("Unknown operator: %s") % mydep) |
2300 |
else: |
2301 |
- raise KeyError("Unknown operator: %s" % mydep) |
2302 |
+ raise KeyError(_("Unknown operator: %s") % mydep) |
2303 |
|
2304 |
if slot is not None: |
2305 |
candidate_list = mylist |
2306 |
|
2307 |
Modified: main/branches/prefix/pym/portage/dispatch_conf.py |
2308 |
=================================================================== |
2309 |
--- main/branches/prefix/pym/portage/dispatch_conf.py 2009-08-24 09:20:57 UTC (rev 14136) |
2310 |
+++ main/branches/prefix/pym/portage/dispatch_conf.py 2009-08-24 09:27:07 UTC (rev 14137) |
2311 |
@@ -11,6 +11,7 @@ |
2312 |
import os, sys, commands, shutil |
2313 |
|
2314 |
import portage, portage.const |
2315 |
+from portage.localization import _ |
2316 |
|
2317 |
RCS_BRANCH = '1.1.1' |
2318 |
RCS_LOCK = 'rcs -ko -M -l' |
2319 |
@@ -27,7 +28,7 @@ |
2320 |
opts = None |
2321 |
|
2322 |
if not opts: |
2323 |
- print >> sys.stderr, 'dispatch-conf: Error reading '+portage.const.EPREFIX+'/etc/dispatch-conf.conf; fatal' |
2324 |
+ print >> sys.stderr, _('dispatch-conf: Error reading %s/etc/dispatch-conf.conf; fatal') % (portage.const.EPREFIX,) |
2325 |
sys.exit(1) |
2326 |
|
2327 |
for key in mandatory_opts: |
2328 |
@@ -35,12 +36,12 @@ |
2329 |
if key == "merge": |
2330 |
opts["merge"] = "sdiff --suppress-common-lines --output='%s' '%s' '%s'" |
2331 |
else: |
2332 |
- print >> sys.stderr, 'dispatch-conf: Missing option "%s" in /etc/dispatch-conf.conf; fatal' % (key,) |
2333 |
+ print >> sys.stderr, _('dispatch-conf: Missing option "%s" in /etc/dispatch-conf.conf; fatal') % (key,) |
2334 |
|
2335 |
if not os.path.exists(opts['archive-dir']): |
2336 |
os.mkdir(opts['archive-dir']) |
2337 |
elif not os.path.isdir(opts['archive-dir']): |
2338 |
- print >> sys.stderr, 'dispatch-conf: Config archive dir [%s] must exist; fatal' % (opts['archive-dir'],) |
2339 |
+ print >> sys.stderr, _('dispatch-conf: Config archive dir [%s] must exist; fatal') % (opts['archive-dir'],) |
2340 |
sys.exit(1) |
2341 |
|
2342 |
return opts |
2343 |
@@ -61,8 +62,8 @@ |
2344 |
try: |
2345 |
shutil.copy2(curconf, archive) |
2346 |
except(IOError, os.error), why: |
2347 |
- print >> sys.stderr, 'dispatch-conf: Error copying %s to %s: %s; fatal' % \ |
2348 |
- (curconf, archive, str(why)) |
2349 |
+ print >> sys.stderr, _('dispatch-conf: Error copying %(curconf)s to %(archive)s: %(reason)s; fatal') % \ |
2350 |
+ {"curconf": curconf, "archive": archive, "reason": str(why)} |
2351 |
if os.path.exists(archive + ',v'): |
2352 |
os.system(RCS_LOCK + ' ' + archive) |
2353 |
os.system(RCS_PUT + ' ' + archive) |
2354 |
@@ -77,8 +78,8 @@ |
2355 |
try: |
2356 |
shutil.copy2(newconf, archive) |
2357 |
except(IOError, os.error), why: |
2358 |
- print >> sys.stderr, 'dispatch-conf: Error copying %s to %s: %s; fatal' % \ |
2359 |
- (newconf, archive, str(why)) |
2360 |
+ print >> sys.stderr, _('dispatch-conf: Error copying %(newconf)s to %(archive)s: %(reason)s; fatal') % \ |
2361 |
+ {"newconf": newconf, "archive": archive, "reason": str(why)} |
2362 |
|
2363 |
if has_branch: |
2364 |
if mrgconf != '': |
2365 |
@@ -120,16 +121,16 @@ |
2366 |
try: |
2367 |
shutil.copy2(curconf, archive) |
2368 |
except(IOError, os.error), why: |
2369 |
- print >> sys.stderr, 'dispatch-conf: Error copying %s to %s: %s; fatal' % \ |
2370 |
- (curconf, archive, str(why)) |
2371 |
+ print >> sys.stderr, _('dispatch-conf: Error copying %(curconf)s to %(archive)s: %(reason)s; fatal') % \ |
2372 |
+ {"curconf": curconf, "archive": archive, "reason": str(why)} |
2373 |
|
2374 |
if newconf != '': |
2375 |
# Save off new config file in the archive dir with .dist.new suffix |
2376 |
try: |
2377 |
shutil.copy2(newconf, archive + '.dist.new') |
2378 |
except(IOError, os.error), why: |
2379 |
- print >> sys.stderr, 'dispatch-conf: Error copying %s to %s: %s; fatal' % \ |
2380 |
- (newconf, archive + '.dist.new', str(why)) |
2381 |
+ print >> sys.stderr, _('dispatch-conf: Error copying %(newconf)s to %(archive)s: %(reason)s; fatal') % \ |
2382 |
+ {"newconf": newconf, "archive": archive + '.dist.new', "reason": str(why)} |
2383 |
|
2384 |
ret = 0 |
2385 |
if mrgconf != '' and os.path.exists(archive + '.dist'): |
2386 |
|
2387 |
Modified: main/branches/prefix/pym/portage/exception.py |
2388 |
=================================================================== |
2389 |
--- main/branches/prefix/pym/portage/exception.py 2009-08-24 09:20:57 UTC (rev 14136) |
2390 |
+++ main/branches/prefix/pym/portage/exception.py 2009-08-24 09:27:07 UTC (rev 14137) |
2391 |
@@ -2,6 +2,7 @@ |
2392 |
# Distributed under the terms of the GNU General Public License v2 |
2393 |
# $Id$ |
2394 |
|
2395 |
+from portage.localization import _ |
2396 |
|
2397 |
class PortageException(Exception): |
2398 |
"""General superclass for portage exceptions""" |
2399 |
@@ -95,10 +96,10 @@ |
2400 |
def __init__(self, cpv, eapi): |
2401 |
self.cpv, self.eapi = cpv, eapi |
2402 |
def __str__(self): |
2403 |
- msg = ("Unable to do any operations on '%s', since " + \ |
2404 |
- "it's EAPI is higher than this portage version's. Please upgrade" + \ |
2405 |
- " to a portage version that supports EAPI '%s'.") % \ |
2406 |
- (self.cpv, str(self.eapi).lstrip("-")) |
2407 |
+ msg = _("Unable to do any operations on '%(cpv)s', since " |
2408 |
+ "it's EAPI is higher than this portage version's. Please upgrade" |
2409 |
+ " to a portage version that supports EAPI '%(eapi)s'.") % \ |
2410 |
+ {"cpv": self.cpv, "eapi": str(self.eapi).lstrip("-")} |
2411 |
return msg |
2412 |
|
2413 |
|
2414 |
|
2415 |
Modified: main/branches/prefix/pym/portage/getbinpkg.py |
2416 |
=================================================================== |
2417 |
--- main/branches/prefix/pym/portage/getbinpkg.py 2009-08-24 09:20:57 UTC (rev 14136) |
2418 |
+++ main/branches/prefix/pym/portage/getbinpkg.py 2009-08-24 09:27:07 UTC (rev 14137) |
2419 |
@@ -5,6 +5,7 @@ |
2420 |
|
2421 |
from portage.output import colorize |
2422 |
from portage.cache.mappings import slot_dict_class |
2423 |
+from portage.localization import _ |
2424 |
import portage |
2425 |
import HTMLParser |
2426 |
import sys |
2427 |
@@ -84,8 +85,8 @@ |
2428 |
|
2429 |
parts = baseurl.split("://",1) |
2430 |
if len(parts) != 2: |
2431 |
- raise ValueError("Provided URL does not " + \ |
2432 |
- "contain protocol identifier. '%s'" % baseurl) |
2433 |
+ raise ValueError(_("Provided URL does not " |
2434 |
+ "contain protocol identifier. '%s'") % baseurl) |
2435 |
protocol,url_parts = parts |
2436 |
del parts |
2437 |
|
2438 |
@@ -107,7 +108,7 @@ |
2439 |
del userpass_host |
2440 |
|
2441 |
if len(userpass) > 2: |
2442 |
- raise ValueError("Unable to interpret username/password provided.") |
2443 |
+ raise ValueError(_("Unable to interpret username/password provided.")) |
2444 |
elif len(userpass) == 2: |
2445 |
username = userpass[0] |
2446 |
password = userpass[1] |
2447 |
@@ -142,7 +143,7 @@ |
2448 |
conn.login(username,password) |
2449 |
else: |
2450 |
sys.stderr.write(colorize("WARN", |
2451 |
- " * No password provided for username")+" '%s'" % \ |
2452 |
+ _(" * No password provided for username"))+" '%s'" % \ |
2453 |
(username,) + "\n\n") |
2454 |
conn.login(username) |
2455 |
conn.set_pasv(passive) |
2456 |
@@ -152,12 +153,12 @@ |
2457 |
import paramiko |
2458 |
except ImportError: |
2459 |
raise NotImplementedError( |
2460 |
- "paramiko must be installed for sftp support") |
2461 |
+ _("paramiko must be installed for sftp support")) |
2462 |
t = paramiko.Transport(host) |
2463 |
t.connect(username=username, password=password) |
2464 |
conn = paramiko.SFTPClient.from_transport(t) |
2465 |
else: |
2466 |
- raise NotImplementedError, "%s is not a supported protocol." % protocol |
2467 |
+ raise NotImplementedError, _("%s is not a supported protocol.") % protocol |
2468 |
|
2469 |
return (conn,protocol,address, http_params, http_headers) |
2470 |
|
2471 |
@@ -236,10 +237,10 @@ |
2472 |
if parts[0] == "Location": |
2473 |
if (rc == 301): |
2474 |
sys.stderr.write(colorize("BAD", |
2475 |
- "Location has moved: ") + str(parts[1]) + "\n") |
2476 |
+ _("Location has moved: ")) + str(parts[1]) + "\n") |
2477 |
if (rc == 302): |
2478 |
sys.stderr.write(colorize("BAD", |
2479 |
- "Location has temporarily moved: ") + \ |
2480 |
+ _("Location has temporarily moved: ")) + \ |
2481 |
str(parts[1]) + "\n") |
2482 |
address = parts[1] |
2483 |
break |
2484 |
@@ -318,7 +319,7 @@ |
2485 |
else: |
2486 |
import portage.exception |
2487 |
raise portage.exception.PortageException( |
2488 |
- "Unable to get listing: %s %s" % (rc,msg)) |
2489 |
+ _("Unable to get listing: %s %s") % (rc,msg)) |
2490 |
elif protocol in ["ftp"]: |
2491 |
if address[-1] == '/': |
2492 |
olddir = conn.pwd() |
2493 |
@@ -331,7 +332,7 @@ |
2494 |
elif protocol == "sftp": |
2495 |
listing = conn.listdir(address) |
2496 |
else: |
2497 |
- raise TypeError("Unknown protocol. '%s'" % protocol) |
2498 |
+ raise TypeError(_("Unknown protocol. '%s'") % protocol) |
2499 |
|
2500 |
if not keepconnection: |
2501 |
conn.close() |
2502 |
@@ -363,7 +364,7 @@ |
2503 |
finally: |
2504 |
f.close() |
2505 |
else: |
2506 |
- raise TypeError("Unknown protocol. '%s'" % protocol) |
2507 |
+ raise TypeError(_("Unknown protocol. '%s'") % protocol) |
2508 |
|
2509 |
if data: |
2510 |
xpaksize = portage.xpak.decodeint(data[-8:-4]) |
2511 |
@@ -413,7 +414,7 @@ |
2512 |
} |
2513 |
retval = spawn(myfetch, env=os.environ.copy(), fd_pipes=fd_pipes) |
2514 |
if retval != os.EX_OK: |
2515 |
- sys.stderr.write("Fetcher exited with a failure condition.\n") |
2516 |
+ sys.stderr.write(_("Fetcher exited with a failure condition.\n")) |
2517 |
return 0 |
2518 |
return 1 |
2519 |
|
2520 |
@@ -454,7 +455,7 @@ |
2521 |
finally: |
2522 |
f.close() |
2523 |
else: |
2524 |
- raise TypeError("Unknown protocol. '%s'" % protocol) |
2525 |
+ raise TypeError(_("Unknown protocol. '%s'") % protocol) |
2526 |
|
2527 |
if not keepconnection: |
2528 |
conn.close() |
2529 |
@@ -494,7 +495,7 @@ |
2530 |
# TODO: If py3k, override Unpickler.find_class(). |
2531 |
pass |
2532 |
metadata = mypickle.load() |
2533 |
- out.write("Loaded metadata pickle.\n") |
2534 |
+ out.write(_("Loaded metadata pickle.\n")) |
2535 |
out.flush() |
2536 |
metadatafile.close() |
2537 |
except (IOError, OSError, EOFError, ValueError, pickle.UnpicklingError): |
2538 |
@@ -511,15 +512,15 @@ |
2539 |
metadata[baseurl]["data"]={} |
2540 |
|
2541 |
if not os.access(cache_path, os.W_OK): |
2542 |
- sys.stderr.write("!!! Unable to write binary metadata to disk!\n") |
2543 |
- sys.stderr.write("!!! Permission denied: '%s'\n" % cache_path) |
2544 |
+ sys.stderr.write(_("!!! Unable to write binary metadata to disk!\n")) |
2545 |
+ sys.stderr.write(_("!!! Permission denied: '%s'\n") % cache_path) |
2546 |
return metadata[baseurl]["data"] |
2547 |
|
2548 |
import portage.exception |
2549 |
try: |
2550 |
filelist = dir_get_list(baseurl, conn) |
2551 |
except portage.exception.PortageException, e: |
2552 |
- sys.stderr.write("!!! Error connecting to '%s'.\n" % baseurl) |
2553 |
+ sys.stderr.write(_("!!! Error connecting to '%s'.\n") % baseurl) |
2554 |
sys.stderr.write("!!! %s\n" % str(e)) |
2555 |
del e |
2556 |
return metadata[baseurl]["data"] |
2557 |
@@ -546,7 +547,7 @@ |
2558 |
except ValueError, e: |
2559 |
sys.stderr.write("--- "+str(e)+"\n") |
2560 |
if trynum < 3: |
2561 |
- sys.stderr.write("Retrying...\n") |
2562 |
+ sys.stderr.write(_("Retrying...\n")) |
2563 |
sys.stderr.flush() |
2564 |
mytempfile.close() |
2565 |
continue |
2566 |
@@ -562,7 +563,7 @@ |
2567 |
raise |
2568 |
except Exception, e: |
2569 |
mytempfile.close() |
2570 |
- sys.stderr.write("!!! Failed to use gzip: "+str(e)+"\n") |
2571 |
+ sys.stderr.write(_("!!! Failed to use gzip: ")+str(e)+"\n") |
2572 |
sys.stderr.flush() |
2573 |
mytempfile.close() |
2574 |
try: |
2575 |
@@ -571,13 +572,13 @@ |
2576 |
metadata[baseurl]["indexname"] = mfile |
2577 |
metadata[baseurl]["timestamp"] = int(time.time()) |
2578 |
metadata[baseurl]["modified"] = 0 # It's not, right after download. |
2579 |
- out.write("Pickle loaded.\n") |
2580 |
+ out.write(_("Pickle loaded.\n")) |
2581 |
out.flush() |
2582 |
break |
2583 |
except SystemExit, e: |
2584 |
raise |
2585 |
except Exception, e: |
2586 |
- sys.stderr.write("!!! Failed to read data from index: "+str(mfile)+"\n") |
2587 |
+ sys.stderr.write(_("!!! Failed to read data from index: ")+str(mfile)+"\n") |
2588 |
sys.stderr.write("!!! "+str(e)+"\n") |
2589 |
sys.stderr.flush() |
2590 |
try: |
2591 |
@@ -587,7 +588,7 @@ |
2592 |
except SystemExit, e: |
2593 |
raise |
2594 |
except Exception, e: |
2595 |
- sys.stderr.write("!!! Failed to write binary metadata to disk!\n") |
2596 |
+ sys.stderr.write(_("!!! Failed to write binary metadata to disk!\n")) |
2597 |
sys.stderr.write("!!! "+str(e)+"\n") |
2598 |
sys.stderr.flush() |
2599 |
break |
2600 |
@@ -608,8 +609,8 @@ |
2601 |
self.display() |
2602 |
def display(self): |
2603 |
self.out.write("\r"+colorize("WARN", |
2604 |
- "cache miss: '"+str(self.misses)+"'") + \ |
2605 |
- " --- "+colorize("GOOD","cache hit: '"+str(self.hits)+"'")) |
2606 |
+ _("cache miss: '")+str(self.misses)+"'") + \ |
2607 |
+ " --- "+colorize("GOOD", _("cache hit: '")+str(self.hits)+"'")) |
2608 |
self.out.flush() |
2609 |
|
2610 |
cache_stats = CacheStats(out) |
2611 |
@@ -652,7 +653,7 @@ |
2612 |
metadata[baseurl]["data"][x] = make_metadata_dict(myid) |
2613 |
elif verbose: |
2614 |
sys.stderr.write(colorize("BAD", |
2615 |
- "!!! Failed to retrieve metadata on: ")+str(x)+"\n") |
2616 |
+ _("!!! Failed to retrieve metadata on: "))+str(x)+"\n") |
2617 |
sys.stderr.flush() |
2618 |
else: |
2619 |
cache_stats.hits += 1 |
2620 |
@@ -683,7 +684,7 @@ |
2621 |
except SystemExit, e: |
2622 |
raise |
2623 |
except Exception, e: |
2624 |
- sys.stderr.write("!!! Failed to write binary metadata to disk!\n") |
2625 |
+ sys.stderr.write(_("!!! Failed to write binary metadata to disk!\n")) |
2626 |
sys.stderr.write("!!! "+str(e)+"\n") |
2627 |
sys.stderr.flush() |
2628 |
|
2629 |
|
2630 |
Modified: main/branches/prefix/pym/portage/glsa.py |
2631 |
=================================================================== |
2632 |
--- main/branches/prefix/pym/portage/glsa.py 2009-08-24 09:20:57 UTC (rev 14136) |
2633 |
+++ main/branches/prefix/pym/portage/glsa.py 2009-08-24 09:27:07 UTC (rev 14137) |
2634 |
@@ -11,6 +11,7 @@ |
2635 |
from portage.versions import pkgsplit, catpkgsplit, pkgcmp, best |
2636 |
from portage.util import grabfile |
2637 |
from portage.const import CACHE_PATH |
2638 |
+from portage.localization import _ |
2639 |
|
2640 |
# Note: the space for rgt and rlt is important !! |
2641 |
# FIXME: use slot deps instead, requires GLSA format versioning |
2642 |
@@ -185,7 +186,7 @@ |
2643 |
elif subnode.nodeName == "#text": |
2644 |
rValue += subnode.data |
2645 |
else: |
2646 |
- raise GlsaFormatException("Invalid Tag found: ", subnode.nodeName) |
2647 |
+ raise GlsaFormatException(_("Invalid Tag found: "), subnode.nodeName) |
2648 |
if format == "strip": |
2649 |
rValue = rValue.strip(" \n\t") |
2650 |
rValue = re.sub("[\s]{2,}", " ", rValue) |
2651 |
@@ -439,7 +440,7 @@ |
2652 |
elif os.path.exists(myid): |
2653 |
self.type = "file" |
2654 |
else: |
2655 |
- raise GlsaArgumentException("Given ID "+myid+" isn't a valid GLSA ID or filename.") |
2656 |
+ raise GlsaArgumentException(_("Given ID %s isn't a valid GLSA ID or filename.") % myid) |
2657 |
self.nr = myid |
2658 |
self.config = myconfig |
2659 |
self.vardbapi = vardbapi |
2660 |
@@ -487,7 +488,7 @@ |
2661 |
raise GlsaTypeException(self.DOM.doctype.systemId) |
2662 |
myroot = self.DOM.getElementsByTagName("glsa")[0] |
2663 |
if self.type == "id" and myroot.getAttribute("id") != self.nr: |
2664 |
- raise GlsaFormatException("filename and internal id don't match:" + myroot.getAttribute("id") + " != " + self.nr) |
2665 |
+ raise GlsaFormatException(_("filename and internal id don't match:") + myroot.getAttribute("id") + " != " + self.nr) |
2666 |
|
2667 |
# the simple (single, required, top-level, #PCDATA) tags first |
2668 |
self.title = getText(myroot.getElementsByTagName("title")[0], format="strip") |
2669 |
@@ -510,7 +511,7 @@ |
2670 |
try: |
2671 |
self.count = int(count) |
2672 |
except ValueError: |
2673 |
- # TODO should this rais a GlsaFormatException? |
2674 |
+ # TODO should this raise a GlsaFormatException? |
2675 |
self.count = 1 |
2676 |
|
2677 |
# now the optional and 0-n toplevel, #PCDATA tags and references |
2678 |
@@ -566,27 +567,27 @@ |
2679 |
width = 76 |
2680 |
outstream.write(("GLSA %s: \n%s" % (self.nr, self.title)).center(width)+"\n") |
2681 |
outstream.write((width*"=")+"\n") |
2682 |
- outstream.write(wrap(self.synopsis, width, caption="Synopsis: ")+"\n") |
2683 |
- outstream.write("Announced on: %s\n" % self.announced) |
2684 |
- outstream.write("Last revised on: %s : %02d\n\n" % (self.revised, self.count)) |
2685 |
+ outstream.write(wrap(self.synopsis, width, caption=_("Synopsis: "))+"\n") |
2686 |
+ outstream.write(_("Announced on: %s\n") % self.announced) |
2687 |
+ outstream.write(_("Last revised on: %s : %02d\n\n") % (self.revised, self.count)) |
2688 |
if self.glsatype == "ebuild": |
2689 |
for k in self.packages.keys(): |
2690 |
pkg = self.packages[k] |
2691 |
for path in pkg: |
2692 |
vul_vers = "".join(path["vul_vers"]) |
2693 |
unaff_vers = "".join(path["unaff_vers"]) |
2694 |
- outstream.write("Affected package: %s\n" % k) |
2695 |
- outstream.write("Affected archs: ") |
2696 |
+ outstream.write(_("Affected package: %s\n") % k) |
2697 |
+ outstream.write(_("Affected archs: ")) |
2698 |
if path["arch"] == "*": |
2699 |
- outstream.write("All\n") |
2700 |
+ outstream.write(_("All\n")) |
2701 |
else: |
2702 |
outstream.write("%s\n" % path["arch"]) |
2703 |
- outstream.write("Vulnerable: %s\n" % vul_vers) |
2704 |
- outstream.write("Unaffected: %s\n\n" % unaff_vers) |
2705 |
+ outstream.write(_("Vulnerable: %s\n") % vul_vers) |
2706 |
+ outstream.write(_("Unaffected: %s\n\n") % unaff_vers) |
2707 |
elif self.glsatype == "infrastructure": |
2708 |
pass |
2709 |
if len(self.bugs) > 0: |
2710 |
- outstream.write("\nRelated bugs: ") |
2711 |
+ outstream.write(_("\nRelated bugs: ")) |
2712 |
for i in range(0, len(self.bugs)): |
2713 |
outstream.write(self.bugs[i]) |
2714 |
if i < len(self.bugs)-1: |
2715 |
@@ -594,15 +595,15 @@ |
2716 |
else: |
2717 |
outstream.write("\n") |
2718 |
if self.background: |
2719 |
- outstream.write("\n"+wrap(self.background, width, caption="Background: ")) |
2720 |
- outstream.write("\n"+wrap(self.description, width, caption="Description: ")) |
2721 |
- outstream.write("\n"+wrap(self.impact_text, width, caption="Impact: ")) |
2722 |
- outstream.write("\n"+wrap(self.workaround, width, caption="Workaround: ")) |
2723 |
- outstream.write("\n"+wrap(self.resolution, width, caption="Resolution: ")) |
2724 |
+ outstream.write("\n"+wrap(self.background, width, caption=_("Background: "))) |
2725 |
+ outstream.write("\n"+wrap(self.description, width, caption=_("Description: "))) |
2726 |
+ outstream.write("\n"+wrap(self.impact_text, width, caption=_("Impact: "))) |
2727 |
+ outstream.write("\n"+wrap(self.workaround, width, caption=_("Workaround: "))) |
2728 |
+ outstream.write("\n"+wrap(self.resolution, width, caption=_("Resolution: "))) |
2729 |
myreferences = "" |
2730 |
for r in self.references: |
2731 |
myreferences += (r.replace(" ", SPACE_ESCAPE)+NEWLINE_ESCAPE+" ") |
2732 |
- outstream.write("\n"+wrap(myreferences, width, caption="References: ")) |
2733 |
+ outstream.write("\n"+wrap(myreferences, width, caption=_("References: "))) |
2734 |
outstream.write("\n") |
2735 |
|
2736 |
def isVulnerable(self): |
2737 |
|
2738 |
Modified: main/branches/prefix/pym/portage/locks.py |
2739 |
=================================================================== |
2740 |
--- main/branches/prefix/pym/portage/locks.py 2009-08-24 09:20:57 UTC (rev 14136) |
2741 |
+++ main/branches/prefix/pym/portage/locks.py 2009-08-24 09:27:07 UTC (rev 14137) |
2742 |
@@ -36,7 +36,7 @@ |
2743 |
import fcntl |
2744 |
|
2745 |
if not mypath: |
2746 |
- raise InvalidData("Empty path given") |
2747 |
+ raise InvalidData(_("Empty path given")) |
2748 |
|
2749 |
if isinstance(mypath, basestring) and mypath[-1] == '/': |
2750 |
mypath = mypath[:-1] |
2751 |
@@ -83,8 +83,8 @@ |
2752 |
unlinkfile=unlinkfile, waiting_msg=waiting_msg, |
2753 |
flags=flags) |
2754 |
else: |
2755 |
- writemsg("Cannot chown a lockfile. This could " + \ |
2756 |
- "cause inconvenience later.\n") |
2757 |
+ writemsg(_("Cannot chown a lockfile. This could " |
2758 |
+ "cause inconvenience later.\n")) |
2759 |
|
2760 |
finally: |
2761 |
os.umask(old_mask) |
2762 |
@@ -93,7 +93,7 @@ |
2763 |
myfd = mypath |
2764 |
|
2765 |
else: |
2766 |
- raise ValueError("Unknown type passed in '%s': '%s'" % \ |
2767 |
+ raise ValueError(_("Unknown type passed in '%s': '%s'") % \ |
2768 |
(type(mypath), mypath)) |
2769 |
|
2770 |
# try for a non-blocking lock, if it's held, throw a message |
2771 |
@@ -114,9 +114,9 @@ |
2772 |
out.quiet = _quiet |
2773 |
if waiting_msg is None: |
2774 |
if isinstance(mypath, int): |
2775 |
- waiting_msg = "waiting for lock on fd %i" % myfd |
2776 |
+ waiting_msg = _("waiting for lock on fd %i") % myfd |
2777 |
else: |
2778 |
- waiting_msg = "waiting for lock on %s\n" % lockfilename |
2779 |
+ waiting_msg = _("waiting for lock on %s\n") % lockfilename |
2780 |
out.ebegin(waiting_msg) |
2781 |
# try for the exclusive lock now. |
2782 |
try: |
2783 |
@@ -149,7 +149,7 @@ |
2784 |
myfd != HARDLINK_FD and _fstat_nlink(myfd) == 0: |
2785 |
# The file was deleted on us... Keep trying to make one... |
2786 |
os.close(myfd) |
2787 |
- writemsg("lockfile recurse\n",1) |
2788 |
+ writemsg(_("lockfile recurse\n"), 1) |
2789 |
lockfilename, myfd, unlinkfile, locking_method = lockfile( |
2790 |
mypath, wantnewlockfile=wantnewlockfile, unlinkfile=unlinkfile, |
2791 |
waiting_msg=waiting_msg, flags=flags) |
2792 |
@@ -192,7 +192,7 @@ |
2793 |
# myfd may be None here due to myfd = mypath in lockfile() |
2794 |
if isinstance(lockfilename, basestring) and \ |
2795 |
not os.path.exists(lockfilename): |
2796 |
- writemsg("lockfile does not exist '%s'\n" % lockfilename,1) |
2797 |
+ writemsg(_("lockfile does not exist '%s'\n") % lockfilename,1) |
2798 |
if myfd is not None: |
2799 |
os.close(myfd) |
2800 |
return False |
2801 |
@@ -205,7 +205,7 @@ |
2802 |
except OSError: |
2803 |
if isinstance(lockfilename, basestring): |
2804 |
os.close(myfd) |
2805 |
- raise IOError("Failed to unlock file '%s'\n" % lockfilename) |
2806 |
+ raise IOError(_("Failed to unlock file '%s'\n") % lockfilename) |
2807 |
|
2808 |
try: |
2809 |
# This sleep call was added to allow other processes that are |
2810 |
@@ -218,17 +218,17 @@ |
2811 |
locking_method(myfd,fcntl.LOCK_EX|fcntl.LOCK_NB) |
2812 |
# We won the lock, so there isn't competition for it. |
2813 |
# We can safely delete the file. |
2814 |
- writemsg("Got the lockfile...\n",1) |
2815 |
+ writemsg(_("Got the lockfile...\n"), 1) |
2816 |
if _fstat_nlink(myfd) == 1: |
2817 |
os.unlink(lockfilename) |
2818 |
- writemsg("Unlinked lockfile...\n",1) |
2819 |
+ writemsg(_("Unlinked lockfile...\n"), 1) |
2820 |
locking_method(myfd,fcntl.LOCK_UN) |
2821 |
else: |
2822 |
- writemsg("lockfile does not exist '%s'\n" % lockfilename,1) |
2823 |
+ writemsg(_("lockfile does not exist '%s'\n") % lockfilename, 1) |
2824 |
os.close(myfd) |
2825 |
return False |
2826 |
except Exception, e: |
2827 |
- writemsg("Failed to get lock... someone took it.\n",1) |
2828 |
+ writemsg(_("Failed to get lock... someone took it.\n"), 1) |
2829 |
writemsg(str(e)+"\n",1) |
2830 |
|
2831 |
# why test lockfilename? because we may have been handed an |
2832 |
@@ -290,10 +290,10 @@ |
2833 |
else: |
2834 |
reported_waiting = True |
2835 |
from portage.const import PORTAGE_BIN_PATH |
2836 |
- msg = "\nWaiting on (hardlink) lockfile:" + \ |
2837 |
- " (one '.' per 3 seconds)\n" + \ |
2838 |
- "%s/clean_locks can fix stuck locks.\n" % PORTAGE_BIN_PATH + \ |
2839 |
- "Lockfile: %s\n" % lockfilename |
2840 |
+ msg = _("\nWaiting on (hardlink) lockfile: (one '.' per 3 seconds)\n" |
2841 |
+ "%(bin_path)s/clean_locks can fix stuck locks.\n" |
2842 |
+ "Lockfile: %(lockfilename)s\n") % \ |
2843 |
+ {"bin_path": PORTAGE_BIN_PATH, "lockfilename": lockfilename} |
2844 |
writemsg(msg, noiselevel=-1) |
2845 |
time.sleep(3) |
2846 |
|
2847 |
@@ -340,7 +340,7 @@ |
2848 |
mycount += 1 |
2849 |
|
2850 |
|
2851 |
- results.append("Found %(count)s locks" % {"count":mycount}) |
2852 |
+ results.append(_("Found %(count)s locks") % {"count":mycount}) |
2853 |
|
2854 |
for x in mylist: |
2855 |
if myhost in mylist[x] or remove_all_locks: |
2856 |
|
2857 |
Modified: main/branches/prefix/pym/portage/mail.py |
2858 |
=================================================================== |
2859 |
--- main/branches/prefix/pym/portage/mail.py 2009-08-24 09:20:57 UTC (rev 14136) |
2860 |
+++ main/branches/prefix/pym/portage/mail.py 2009-08-24 09:27:07 UTC (rev 14137) |
2861 |
@@ -8,6 +8,7 @@ |
2862 |
from email.MIMEMultipart import MIMEMultipart as MultipartMessage |
2863 |
from email.MIMEBase import MIMEBase as BaseMessage |
2864 |
from email.header import Header |
2865 |
+from portage.localization import _ |
2866 |
|
2867 |
def create_message(sender, recipient, subject, body, attachments=None): |
2868 |
|
2869 |
@@ -34,7 +35,7 @@ |
2870 |
x = x.encode('utf_8', 'replace') |
2871 |
mymessage.attach(TextMessage(x)) |
2872 |
else: |
2873 |
- raise portage.exception.PortageException("Can't handle type of attachment: %s" % type(x)) |
2874 |
+ raise portage.exception.PortageException(_("Can't handle type of attachment: %s") % type(x)) |
2875 |
|
2876 |
mymessage.set_unixfrom(sender) |
2877 |
mymessage["To"] = recipient |
2878 |
@@ -68,7 +69,7 @@ |
2879 |
try: |
2880 |
mymailuser,mymailpasswd = myauthdata.split(":") |
2881 |
except ValueError: |
2882 |
- print "!!! invalid SMTP AUTH configuration, trying unauthenticated ..." |
2883 |
+ print _("!!! invalid SMTP AUTH configuration, trying unauthenticated ...") |
2884 |
else: |
2885 |
myconndata = mymailuri |
2886 |
if ":" in myconndata: |
2887 |
@@ -99,14 +100,14 @@ |
2888 |
fd = os.popen(mymailhost+" -f "+myfrom+" "+myrecipient, "w") |
2889 |
fd.write(message.as_string()) |
2890 |
if fd.close() != None: |
2891 |
- sys.stderr.write("!!! %s returned with a non-zero exit code. This generally indicates an error.\n" % mymailhost) |
2892 |
+ sys.stderr.write(_("!!! %s returned with a non-zero exit code. This generally indicates an error.\n") % mymailhost) |
2893 |
else: |
2894 |
try: |
2895 |
if int(mymailport) > 100000: |
2896 |
myconn = smtplib.SMTP(mymailhost, int(mymailport) - 100000) |
2897 |
myconn.ehlo() |
2898 |
if not myconn.has_extn("STARTTLS"): |
2899 |
- raise portage.exception.PortageException("!!! TLS support requested for logmail but not suported by server") |
2900 |
+ raise portage.exception.PortageException(_("!!! TLS support requested for logmail but not suported by server")) |
2901 |
myconn.starttls() |
2902 |
myconn.ehlo() |
2903 |
else: |
2904 |
@@ -116,8 +117,8 @@ |
2905 |
myconn.sendmail(myfrom, myrecipient, message.as_string()) |
2906 |
myconn.quit() |
2907 |
except smtplib.SMTPException, e: |
2908 |
- raise portage.exception.PortageException("!!! An error occured while trying to send logmail:\n"+str(e)) |
2909 |
+ raise portage.exception.PortageException(_("!!! An error occured while trying to send logmail:\n")+str(e)) |
2910 |
except socket.error, e: |
2911 |
- raise portage.exception.PortageException("!!! A network error occured while trying to send logmail:\n"+str(e)+"\nSure you configured PORTAGE_ELOG_MAILURI correctly?") |
2912 |
+ raise portage.exception.PortageException(_("!!! A network error occured while trying to send logmail:\n%s\nSure you configured PORTAGE_ELOG_MAILURI correctly?") % str(e)) |
2913 |
return |
2914 |
|
2915 |
|
2916 |
Modified: main/branches/prefix/pym/portage/manifest.py |
2917 |
=================================================================== |
2918 |
--- main/branches/prefix/pym/portage/manifest.py 2009-08-24 09:20:57 UTC (rev 14136) |
2919 |
+++ main/branches/prefix/pym/portage/manifest.py 2009-08-24 09:27:07 UTC (rev 14137) |
2920 |
@@ -19,6 +19,7 @@ |
2921 |
from portage.exception import DigestException, FileNotFound, \ |
2922 |
InvalidDataType, MissingParameter, PermissionDenied, \ |
2923 |
PortageException, PortagePackageException |
2924 |
+from portage.localization import _ |
2925 |
|
2926 |
class FileNotInManifestException(PortageException): |
2927 |
pass |
2928 |
@@ -221,7 +222,7 @@ |
2929 |
for t in self.fhashdict: |
2930 |
for f in self.fhashdict[t]: |
2931 |
if portage.const.MANIFEST2_REQUIRED_HASH not in self.fhashdict[t][f]: |
2932 |
- raise MissingParameter("Missing %s checksum: %s %s" % (portage.const.MANIFEST2_REQUIRED_HASH, t, f)) |
2933 |
+ raise MissingParameter(_("Missing %s checksum: %s %s") % (portage.const.MANIFEST2_REQUIRED_HASH, t, f)) |
2934 |
|
2935 |
def write(self, sign=False, force=False): |
2936 |
""" Write Manifest instance to disk, optionally signing it """ |
2937 |
@@ -342,11 +343,11 @@ |
2938 |
cpv = "%s/%s" % (cat, pf) |
2939 |
if not ps: |
2940 |
raise PortagePackageException( |
2941 |
- "Invalid package name: '%s'" % cpv) |
2942 |
+ _("Invalid package name: '%s'") % cpv) |
2943 |
if ps[0] != pn: |
2944 |
raise PortagePackageException( |
2945 |
- "Package name does not " + \ |
2946 |
- "match directory name: '%s'" % cpv) |
2947 |
+ _("Package name does not " |
2948 |
+ "match directory name: '%s'") % cpv) |
2949 |
cpvlist.append(cpv) |
2950 |
elif manifest2MiscfileFilter(f): |
2951 |
mytype = "MISC" |
2952 |
@@ -437,7 +438,7 @@ |
2953 |
except FileNotFound, e: |
2954 |
if not ignoreMissing: |
2955 |
raise |
2956 |
- return False, "File Not Found: '%s'" % str(e) |
2957 |
+ return False, _("File Not Found: '%s'") % str(e) |
2958 |
|
2959 |
def checkCpvHashes(self, cpv, checkDistfiles=True, onlyDistfiles=False, checkMiscfiles=False): |
2960 |
""" check the hashes for all files associated to the given cpv, include all |
2961 |
|
2962 |
Modified: main/branches/prefix/pym/portage/news.py |
2963 |
=================================================================== |
2964 |
--- main/branches/prefix/pym/portage/news.py 2009-08-24 09:20:57 UTC (rev 14136) |
2965 |
+++ main/branches/prefix/pym/portage/news.py 2009-08-24 09:27:07 UTC (rev 14137) |
2966 |
@@ -15,6 +15,7 @@ |
2967 |
grabfile, normalize_path, write_atomic, writemsg_level |
2968 |
from portage.data import portage_gid |
2969 |
from portage.dep import isvalidatom |
2970 |
+from portage.localization import _ |
2971 |
from portage.locks import lockfile, unlockfile |
2972 |
from portage.exception import InvalidLocation, OperationNotPermitted, \ |
2973 |
PermissionDenied |
2974 |
@@ -70,7 +71,7 @@ |
2975 |
def _news_dir(self, repoid): |
2976 |
repo_path = self.portdb.getRepositoryPath(repoid) |
2977 |
if repo_path is None: |
2978 |
- raise AssertionError("Invalid repoID: %s" % repoid) |
2979 |
+ raise AssertionError(_("Invalid repoID: %s") % repoid) |
2980 |
return os.path.join(repo_path, self.news_path) |
2981 |
|
2982 |
def updateItems(self, repoid): |
2983 |
@@ -249,9 +250,9 @@ |
2984 |
if invalids: |
2985 |
self._valid = False |
2986 |
msg = [] |
2987 |
- msg.append("Invalid news item: %s" % (self.path,)) |
2988 |
+ msg.append(_("Invalid news item: %s") % (self.path,)) |
2989 |
for lineno, line in invalids: |
2990 |
- msg.append(" line %d: %s" % (lineno, line)) |
2991 |
+ msg.append(_(" line %d: %s") % (lineno, line)) |
2992 |
writemsg_level("".join("!!! %s\n" % x for x in msg), |
2993 |
level=logging.ERROR, noiselevel=-1) |
2994 |
|
2995 |
@@ -270,7 +271,7 @@ |
2996 |
return True |
2997 |
|
2998 |
def checkRestriction(self, **kwargs): |
2999 |
- raise NotImplementedError('Derived class should over-ride this method') |
3000 |
+ raise NotImplementedError('Derived class should override this method') |
3001 |
|
3002 |
class DisplayProfileRestriction(DisplayRestriction): |
3003 |
""" |
3004 |
|
3005 |
Modified: main/branches/prefix/pym/portage/output.py |
3006 |
=================================================================== |
3007 |
--- main/branches/prefix/pym/portage/output.py 2009-08-24 09:20:57 UTC (rev 14136) |
3008 |
+++ main/branches/prefix/pym/portage/output.py 2009-08-24 09:27:07 UTC (rev 14137) |
3009 |
@@ -21,6 +21,7 @@ |
3010 |
from portage.const import COLOR_MAP_FILE, EPREFIX |
3011 |
from portage.exception import CommandNotFound, FileNotFound, \ |
3012 |
ParseError, PermissionDenied, PortageException |
3013 |
+from portage.localization import _ |
3014 |
|
3015 |
havecolor=1 |
3016 |
dotitles=1 |
3017 |
@@ -177,9 +178,8 @@ |
3018 |
|
3019 |
split_line = line.split("=") |
3020 |
if len(split_line) != 2: |
3021 |
- e = ParseError("'%s', line %s: %s" % ( |
3022 |
- myfile, lineno, |
3023 |
- "expected exactly one occurence of '=' operator")) |
3024 |
+ e = ParseError(_("'%s', line %s: expected exactly one occurence of '=' operator") % \ |
3025 |
+ (myfile, lineno)) |
3026 |
raise e |
3027 |
if onerror: |
3028 |
onerror(e) |
3029 |
@@ -190,9 +190,8 @@ |
3030 |
k = strip_quotes(split_line[0].strip()) |
3031 |
v = strip_quotes(split_line[1].strip()) |
3032 |
if not k in _styles and not k in codes: |
3033 |
- e = ParseError("'%s', line %s: %s'%s'" % ( |
3034 |
- myfile, lineno, |
3035 |
- "Unknown variable: ", k)) |
3036 |
+ e = ParseError(_("'%s', line %s: Unknown variable: '%s'") % \ |
3037 |
+ (myfile, lineno, k)) |
3038 |
if onerror: |
3039 |
onerror(e) |
3040 |
else: |
3041 |
@@ -212,9 +211,8 @@ |
3042 |
elif k in codes: |
3043 |
code_list.append(codes[x]) |
3044 |
else: |
3045 |
- e = ParseError("'%s', line %s: %s'%s'" % ( |
3046 |
- myfile, lineno, |
3047 |
- "Undefined: ", x)) |
3048 |
+ e = ParseError(_("'%s', line %s: Undefined: '%s'") % \ |
3049 |
+ (myfile, lineno, x)) |
3050 |
if onerror: |
3051 |
onerror(e) |
3052 |
else: |
3053 |
@@ -427,7 +425,7 @@ |
3054 |
try: |
3055 |
spawn(cmd, env=os.environ, fd_pipes={0:fd}) |
3056 |
except CommandNotFound: |
3057 |
- writemsg("portage: stty: command not found\n", noiselevel=-1) |
3058 |
+ writemsg(_("portage: stty: command not found\n"), noiselevel=-1) |
3059 |
|
3060 |
class EOutput(object): |
3061 |
""" |
3062 |
@@ -730,7 +728,7 @@ |
3063 |
except FileNotFound: |
3064 |
pass |
3065 |
except PermissionDenied, e: |
3066 |
- writemsg("Permission denied: '%s'\n" % str(e), noiselevel=-1) |
3067 |
+ writemsg(_("Permission denied: '%s'\n") % str(e), noiselevel=-1) |
3068 |
del e |
3069 |
except PortageException, e: |
3070 |
writemsg("%s\n" % str(e), noiselevel=-1) |
3071 |
|
3072 |
Modified: main/branches/prefix/pym/portage/process.py |
3073 |
=================================================================== |
3074 |
--- main/branches/prefix/pym/portage/process.py 2009-08-24 09:20:57 UTC (rev 14136) |
3075 |
+++ main/branches/prefix/pym/portage/process.py 2009-08-24 09:27:07 UTC (rev 14137) |
3076 |
@@ -4,12 +4,14 @@ |
3077 |
# $Id$ |
3078 |
|
3079 |
|
3080 |
-import os |
3081 |
import atexit |
3082 |
import signal |
3083 |
import sys |
3084 |
import traceback |
3085 |
|
3086 |
+from portage import os |
3087 |
+from portage import _content_encoding |
3088 |
+from portage import _unicode_encode |
3089 |
import portage |
3090 |
portage.proxy.lazyimport.lazyimport(globals(), |
3091 |
'portage.util:dump_traceback', |
3092 |
@@ -182,11 +184,8 @@ |
3093 |
# Avoid a potential UnicodeEncodeError from os.execve(). |
3094 |
env_bytes = {} |
3095 |
for k, v in env.iteritems(): |
3096 |
- if isinstance(k, unicode): |
3097 |
- k = k.encode('utf_8', 'replace') |
3098 |
- if isinstance(v, unicode): |
3099 |
- v = v.encode('utf_8', 'replace') |
3100 |
- env_bytes[k] = v |
3101 |
+ env_bytes[_unicode_encode(k, encoding=_content_encoding)] = \ |
3102 |
+ _unicode_encode(v, encoding=_content_encoding) |
3103 |
env = env_bytes |
3104 |
del env_bytes |
3105 |
|
3106 |
|
3107 |
Modified: main/branches/prefix/pym/portage/update.py |
3108 |
=================================================================== |
3109 |
--- main/branches/prefix/pym/portage/update.py 2009-08-24 09:20:57 UTC (rev 14136) |
3110 |
+++ main/branches/prefix/pym/portage/update.py 2009-08-24 09:27:07 UTC (rev 14137) |
3111 |
@@ -12,8 +12,9 @@ |
3112 |
'portage.versions:ververify' |
3113 |
) |
3114 |
|
3115 |
+from portage.const import USER_CONFIG_PATH, WORLD_FILE |
3116 |
from portage.exception import DirectoryNotFound, PortageException |
3117 |
-from portage.const import USER_CONFIG_PATH, WORLD_FILE |
3118 |
+from portage.localization import _ |
3119 |
|
3120 |
ignored_dbentries = ("CONTENTS", "environment.bz2") |
3121 |
|
3122 |
@@ -115,25 +116,25 @@ |
3123 |
if len(mysplit) == 0: |
3124 |
continue |
3125 |
if mysplit[0] not in ("move", "slotmove"): |
3126 |
- errors.append("ERROR: Update type not recognized '%s'" % myline) |
3127 |
+ errors.append(_("ERROR: Update type not recognized '%s'") % myline) |
3128 |
continue |
3129 |
if mysplit[0] == "move": |
3130 |
if len(mysplit) != 3: |
3131 |
- errors.append("ERROR: Update command invalid '%s'" % myline) |
3132 |
+ errors.append(_("ERROR: Update command invalid '%s'") % myline) |
3133 |
continue |
3134 |
orig_value, new_value = mysplit[1], mysplit[2] |
3135 |
for cp in (orig_value, new_value): |
3136 |
if not (isvalidatom(cp) and isjustname(cp)): |
3137 |
errors.append( |
3138 |
- "ERROR: Malformed update entry '%s'" % myline) |
3139 |
+ _("ERROR: Malformed update entry '%s'") % myline) |
3140 |
continue |
3141 |
if mysplit[0] == "slotmove": |
3142 |
if len(mysplit)!=4: |
3143 |
- errors.append("ERROR: Update command invalid '%s'" % myline) |
3144 |
+ errors.append(_("ERROR: Update command invalid '%s'") % myline) |
3145 |
continue |
3146 |
pkg, origslot, newslot = mysplit[1], mysplit[2], mysplit[3] |
3147 |
if not isvalidatom(pkg): |
3148 |
- errors.append("ERROR: Malformed update entry '%s'" % myline) |
3149 |
+ errors.append(_("ERROR: Malformed update entry '%s'") % myline) |
3150 |
continue |
3151 |
|
3152 |
# The list of valid updates is filtered by continue statements above. |
3153 |
@@ -215,7 +216,7 @@ |
3154 |
write_atomic(updating_file, "".join(file_contents[x])) |
3155 |
except PortageException, e: |
3156 |
writemsg("\n!!! %s\n" % str(e), noiselevel=-1) |
3157 |
- writemsg("!!! An error occured while updating a config file:" + \ |
3158 |
+ writemsg(_("!!! An error occured while updating a config file:") + \ |
3159 |
" '%s'\n" % updating_file, noiselevel=-1) |
3160 |
continue |
3161 |
|
3162 |
|
3163 |
Modified: main/branches/prefix/pym/portage/util.py |
3164 |
=================================================================== |
3165 |
--- main/branches/prefix/pym/portage/util.py 2009-08-24 09:20:57 UTC (rev 14136) |
3166 |
+++ main/branches/prefix/pym/portage/util.py 2009-08-24 09:27:07 UTC (rev 14137) |
3167 |
@@ -31,6 +31,7 @@ |
3168 |
from portage.exception import PortageException, FileNotFound, \ |
3169 |
OperationNotPermitted, PermissionDenied, ReadOnlyFileSystem |
3170 |
from portage.dep import isvalidatom |
3171 |
+from portage.localization import _ |
3172 |
from portage.proxy.objectproxy import ObjectProxy |
3173 |
from portage.cache.mappings import UserDict |
3174 |
from portage.const import EPREFIX, EPREFIX_LSTRIP |
3175 |
@@ -295,7 +296,7 @@ |
3176 |
for x in pkgs.keys(): |
3177 |
if not isvalidatom(x): |
3178 |
del(pkgs[x]) |
3179 |
- writemsg("--- Invalid atom in %s: %s\n" % (myfilename, x), |
3180 |
+ writemsg(_("--- Invalid atom in %s: %s\n") % (myfilename, x), |
3181 |
noiselevel=-1) |
3182 |
return pkgs |
3183 |
|
3184 |
@@ -309,7 +310,7 @@ |
3185 |
if pkg[:1] == "*": |
3186 |
pkg = pkg[1:] |
3187 |
if not isvalidatom(pkg): |
3188 |
- writemsg("--- Invalid atom in %s: %s\n" % (myfilename, pkgs[x]), |
3189 |
+ writemsg(_("--- Invalid atom in %s: %s\n") % (myfilename, pkgs[x]), |
3190 |
noiselevel=-1) |
3191 |
del(pkgs[x]) |
3192 |
return pkgs |
3193 |
@@ -374,7 +375,7 @@ |
3194 |
try: |
3195 |
return shlex.shlex.sourcehook(self, newfile) |
3196 |
except EnvironmentError, e: |
3197 |
- writemsg("!!! Parse error in '%s': source command failed: %s\n" % \ |
3198 |
+ writemsg(_("!!! Parse error in '%s': source command failed: %s\n") % \ |
3199 |
(self.infile, str(e)), noiselevel=-1) |
3200 |
return (newfile, StringIO()) |
3201 |
|
3202 |
@@ -391,7 +392,7 @@ |
3203 |
# Workaround for avoiding a silent error in shlex that |
3204 |
# is triggered by a source statement at the end of the file without a |
3205 |
# trailing newline after the source statement |
3206 |
- # NOTE: shex doesn't seem to supported unicode objects |
3207 |
+ # NOTE: shex doesn't seem to support unicode objects |
3208 |
# (produces spurious \0 characters with python-2.6.2) |
3209 |
if sys.hexversion < 0x3000000: |
3210 |
content = open(_unicode_encode(mycfg), 'rb').read() |
3211 |
@@ -433,17 +434,17 @@ |
3212 |
#unexpected end of file |
3213 |
#lex.error_leader(self.filename,lex.lineno) |
3214 |
if not tolerant: |
3215 |
- writemsg("!!! Unexpected end of config file: variable "+str(key)+"\n", |
3216 |
+ writemsg(_("!!! Unexpected end of config file: variable %s\n") % key, |
3217 |
noiselevel=-1) |
3218 |
- raise Exception("ParseError: Unexpected EOF: "+str(mycfg)+": on/before line "+str(lex.lineno)) |
3219 |
+ raise Exception(_("ParseError: Unexpected EOF: %s: on/before line %s") % (mycfg, lex.lineno)) |
3220 |
else: |
3221 |
return mykeys |
3222 |
elif (equ!='='): |
3223 |
#invalid token |
3224 |
#lex.error_leader(self.filename,lex.lineno) |
3225 |
if not tolerant: |
3226 |
- raise Exception("ParseError: Invalid token " + \ |
3227 |
- "'%s' (not '='): %s: line %s" % \ |
3228 |
+ raise Exception(_("ParseError: Invalid token " |
3229 |
+ "'%s' (not '='): %s: line %s") % \ |
3230 |
(equ, mycfg, lex.lineno)) |
3231 |
else: |
3232 |
return mykeys |
3233 |
@@ -452,9 +453,9 @@ |
3234 |
#unexpected end of file |
3235 |
#lex.error_leader(self.filename,lex.lineno) |
3236 |
if not tolerant: |
3237 |
- writemsg("!!! Unexpected end of config file: variable "+str(key)+"\n", |
3238 |
+ writemsg(_("!!! Unexpected end of config file: variable %s\n") % key, |
3239 |
noiselevel=-1) |
3240 |
- raise portage.exception.CorruptionError("ParseError: Unexpected EOF: "+str(mycfg)+": line "+str(lex.lineno)) |
3241 |
+ raise portage.exception.CorruptionError(_("ParseError: Unexpected EOF: %s: line %s") % (mycfg, lex.lineno)) |
3242 |
else: |
3243 |
return mykeys |
3244 |
key = _unicode_decode(key) |
3245 |
@@ -585,7 +586,7 @@ |
3246 |
def pickle_read(filename,default=None,debug=0): |
3247 |
import os |
3248 |
if not os.access(filename, os.R_OK): |
3249 |
- writemsg("pickle_read(): File not readable. '"+filename+"'\n",1) |
3250 |
+ writemsg(_("pickle_read(): File not readable. '")+filename+"'\n",1) |
3251 |
return default |
3252 |
data = None |
3253 |
try: |
3254 |
@@ -594,11 +595,11 @@ |
3255 |
data = mypickle.load() |
3256 |
myf.close() |
3257 |
del mypickle,myf |
3258 |
- writemsg("pickle_read(): Loaded pickle. '"+filename+"'\n",1) |
3259 |
+ writemsg(_("pickle_read(): Loaded pickle. '")+filename+"'\n",1) |
3260 |
except SystemExit, e: |
3261 |
raise |
3262 |
except Exception, e: |
3263 |
- writemsg("!!! Failed to load pickle: "+str(e)+"\n",1) |
3264 |
+ writemsg(_("!!! Failed to load pickle: ")+str(e)+"\n",1) |
3265 |
data = default |
3266 |
return data |
3267 |
|
3268 |
@@ -810,10 +811,10 @@ |
3269 |
# go unnoticed. Callers can pass in a quiet instance. |
3270 |
def onerror(e): |
3271 |
if isinstance(e, OperationNotPermitted): |
3272 |
- writemsg("Operation Not Permitted: %s\n" % str(e), |
3273 |
+ writemsg(_("Operation Not Permitted: %s\n") % str(e), |
3274 |
noiselevel=-1) |
3275 |
elif isinstance(e, FileNotFound): |
3276 |
- writemsg("File Not Found: '%s'\n" % str(e), noiselevel=-1) |
3277 |
+ writemsg(_("File Not Found: '%s'\n") % str(e), noiselevel=-1) |
3278 |
else: |
3279 |
raise |
3280 |
|
3281 |
@@ -918,7 +919,7 @@ |
3282 |
except IOError, e: |
3283 |
if canonical_path == filename: |
3284 |
raise |
3285 |
- writemsg("!!! Failed to open file: '%s'\n" % tmp_name, |
3286 |
+ writemsg(_("!!! Failed to open file: '%s'\n") % tmp_name, |
3287 |
noiselevel=-1) |
3288 |
writemsg("!!! %s\n" % str(e), noiselevel=-1) |
3289 |
|
3290 |
|
3291 |
Modified: main/branches/prefix/pym/portage/versions.py |
3292 |
=================================================================== |
3293 |
--- main/branches/prefix/pym/portage/versions.py 2009-08-24 09:20:57 UTC (rev 14136) |
3294 |
+++ main/branches/prefix/pym/portage/versions.py 2009-08-24 09:27:07 UTC (rev 14137) |
3295 |
@@ -12,13 +12,14 @@ |
3296 |
endversion_keys = ["pre", "p", "alpha", "beta", "rc"] |
3297 |
|
3298 |
from portage.exception import InvalidData |
3299 |
+from portage.localization import _ |
3300 |
|
3301 |
def ververify(myver, silent=1): |
3302 |
if ver_regexp.match(myver): |
3303 |
return 1 |
3304 |
else: |
3305 |
if not silent: |
3306 |
- print "!!! syntax error in version: %s" % myver |
3307 |
+ print _("!!! syntax error in version: %s") % myver |
3308 |
return 0 |
3309 |
|
3310 |
vercmp_cache = {} |
3311 |
@@ -59,11 +60,11 @@ |
3312 |
# checking that the versions are valid |
3313 |
if not match1 or not match1.groups(): |
3314 |
if not silent: |
3315 |
- print "!!! syntax error in version: %s" % ver1 |
3316 |
+ print _("!!! syntax error in version: %s") % ver1 |
3317 |
return None |
3318 |
if not match2 or not match2.groups(): |
3319 |
if not silent: |
3320 |
- print "!!! syntax error in version: %s" % ver2 |
3321 |
+ print _("!!! syntax error in version: %s") % ver2 |
3322 |
return None |
3323 |
|
3324 |
# shortcut for cvs ebuilds (new style) |
3325 |
@@ -241,7 +242,7 @@ |
3326 |
|
3327 |
if len(myparts)<2: |
3328 |
if not silent: |
3329 |
- print "!!! Name error in",mypkg+": missing a version or name part." |
3330 |
+ print _("!!! Name error in %s: missing a version or name part.") % mypkg |
3331 |
pkgcache[mypkg]=None |
3332 |
return None |