summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-08-26 20:01:37 -0700
committerZac Medico <zmedico@gentoo.org>2010-08-26 20:01:37 -0700
commit6aa2a0c5bb6eedf9c8024b1a20d40e802ec13516 (patch)
tree3860b280f4bfccfb8117499b1262c5aaac5bfbd9
parent26798e8a21cf90e87ab2a1c04468fbf6f38d723e (diff)
downloadportage-6aa2a0c5bb6eedf9c8024b1a20d40e802ec13516.tar.gz
portage-6aa2a0c5bb6eedf9c8024b1a20d40e802ec13516.tar.bz2
portage-6aa2a0c5bb6eedf9c8024b1a20d40e802ec13516.zip
Do not include the whole input string in the use_reduce()
InvalidDependString messages since the string is often extremely long which makes it flood the terminal when displayed. Instead we'll have to rely on the caller to display react appropriately to the exception (perhaps displaying the whole input if appropriate).
-rw-r--r--pym/portage/dep/__init__.py42
1 files changed, 21 insertions, 21 deletions
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index 55dd822c1..499b43fc0 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -308,12 +308,12 @@ def use_reduce(depstr, uselist=[], masklist=[], matchall=False, excludeall=[], i
if is_valid_flag:
if not is_valid_flag(flag):
raise portage.exception.InvalidDependString(
- _("use flag '%s' is not referencable in conditional '%s' in '%s' (flag missing from IUSE?)") \
- % (flag, conditional, depstr))
+ _("use flag '%s' is not referencable in conditional '%s' (flag missing from IUSE?)") \
+ % (flag, conditional))
else:
if _valid_use_re.match(flag) is None:
raise portage.exception.InvalidDependString(
- _("invalid use flag '%s' in conditional '%s' in '%s'") % (flag, conditional, depstr))
+ _("invalid use flag '%s' in conditional '%s'") % (flag, conditional))
if is_negated and flag in excludeall:
return False
@@ -334,7 +334,7 @@ def use_reduce(depstr, uselist=[], masklist=[], matchall=False, excludeall=[], i
for x in (")", "(", "||"):
if token.startswith(x) or token.endswith(x):
raise portage.exception.InvalidDependString(
- _("missing whitespace around '%s' at '%s' in '%s', token %s") % (x, token, depstr, pos+1))
+ _("missing whitespace around '%s' at '%s', token %s") % (x, token, pos+1))
mysplit = depstr.split()
#Count the bracket level.
@@ -353,17 +353,17 @@ def use_reduce(depstr, uselist=[], masklist=[], matchall=False, excludeall=[], i
if token == "(":
if need_simple_token:
raise portage.exception.InvalidDependString(
- _("expected: file name, got: '%s' in '%s', token %s") % (token, depstr, pos+1))
+ _("expected: file name, got: '%s', token %s") % (token, pos+1))
need_bracket = False
stack.append([])
level += 1
elif token == ")":
if need_bracket:
raise portage.exception.InvalidDependString(
- _("expected: '(', got: '%s' in '%s', token %s") % (token, depstr, pos+1))
+ _("expected: '(', got: '%s', token %s") % (token, pos+1))
if need_simple_token:
raise portage.exception.InvalidDependString(
- _("expected: file name, got: '%s' in '%s', token %s") % (token, depstr, pos+1))
+ _("expected: file name, got: '%s', token %s") % (token, pos+1))
if level > 0:
level -= 1
l = stack.pop()
@@ -437,26 +437,26 @@ def use_reduce(depstr, uselist=[], masklist=[], matchall=False, excludeall=[], i
else:
raise portage.exception.InvalidDependString(
- _("no matching '%s' for '%s' in '%s', token %s") % ("(", ")", depstr, pos+1))
+ _("no matching '%s' for '%s', token %s") % ("(", ")", pos+1))
elif token == "||":
if is_src_uri:
raise portage.exception.InvalidDependString(
- _("any-of dependencies are not allowed in SRC_URI: '%s', token %s") % (depstr, pos+1))
+ _("any-of dependencies are not allowed in SRC_URI: token %s") % (pos+1,))
if need_bracket:
raise portage.exception.InvalidDependString(
- _("expected: '(', got: '%s' in '%s', token %s") % (token, depstr, pos+1))
+ _("expected: '(', got: '%s', token %s") % (token, pos+1))
need_bracket = True
stack[level].append(token)
elif token == "->":
if need_simple_token:
raise portage.exception.InvalidDependString(
- _("expected: file name, got: '%s' in '%s', token %s") % (token, depstr, pos+1))
+ _("expected: file name, got: '%s', token %s") % (token, pos+1))
if not is_src_uri:
raise portage.exception.InvalidDependString(
- _("SRC_URI arrow are only allowed in SRC_URI: '%s', token %s") % (depstr, pos+1))
+ _("SRC_URI arrow are only allowed in SRC_URI: token %s") % (pos+1,))
if eapi is None or not eapi_has_src_uri_arrows(eapi):
raise portage.exception.InvalidDependString(
- _("SRC_URI arrow not allowed in EAPI %s: '%s', token %s") % (eapi, depstr, pos+1))
+ _("SRC_URI arrow not allowed in EAPI %s: token %s") % (eapi, pos+1))
need_simple_token = True
stack[level].append(token)
else:
@@ -464,12 +464,12 @@ def use_reduce(depstr, uselist=[], masklist=[], matchall=False, excludeall=[], i
if need_bracket:
raise portage.exception.InvalidDependString(
- _("expected: '(', got: '%s' in '%s', token %s") % (token, depstr, pos+1))
+ _("expected: '(', got: '%s', token %s") % (token, pos+1))
if need_simple_token and "/" in token:
#The last token was a SRC_URI arrow, make sure we have a simple file name.
raise portage.exception.InvalidDependString(
- _("expected: file name, got: '%s' in '%s', token %s") % (token, depstr, pos+1))
+ _("expected: file name, got: '%s', token %s") % (token, pos+1))
if token[-1] == "?":
need_bracket = True
@@ -481,13 +481,13 @@ def use_reduce(depstr, uselist=[], masklist=[], matchall=False, excludeall=[], i
token = token_class(token, eapi=eapi)
except InvalidAtom as e:
raise portage.exception.InvalidDependString(
- _("Invalid atom (%s) in '%s', token %s") \
- % (e, depstr, pos+1), errors=(e,))
+ _("Invalid atom (%s), token %s") \
+ % (e, pos+1), errors=(e,))
except SystemExit:
raise
except Exception as e:
raise portage.exception.InvalidDependString(
- _("Invalid token '%s' in '%s', token %s") % (token, depstr, pos+1))
+ _("Invalid token '%s', token %s") % (token, pos+1))
if not matchall and \
hasattr(token, 'evaluate_conditionals'):
@@ -497,15 +497,15 @@ def use_reduce(depstr, uselist=[], masklist=[], matchall=False, excludeall=[], i
if level != 0:
raise portage.exception.InvalidDependString(
- _("Missing '%s' at end of string: '%s'") % (")", depstr))
+ _("Missing '%s' at end of string") % (")",))
if need_bracket:
raise portage.exception.InvalidDependString(
- _("Missing '%s' at end of string: '%s'") % ("(", depstr))
+ _("Missing '%s' at end of string") % ("(",))
if need_simple_token:
raise portage.exception.InvalidDependString(
- _("Missing file name at end of string: '%s'") % (depstr,))
+ _("Missing file name at end of string"))
return stack[0]