From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 54B06138330 for ; Wed, 20 Jul 2016 12:24:04 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 4A7C521C054; Wed, 20 Jul 2016 12:24:03 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 5DB8121C054 for ; Wed, 20 Jul 2016 12:24:02 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 0D4D2340D77 for ; Wed, 20 Jul 2016 12:24:01 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 10C617E2 for ; Wed, 20 Jul 2016 12:23:59 +0000 (UTC) From: "Tiziano Müller" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Tiziano Müller" Message-ID: <1469017431.3cf0af2f5e87a162538e36fcbc8b47723a9c91d4.dev-zero@gentoo> Subject: [gentoo-commits] dev/dev-zero:master commit in: dev-python/parsimonious/, net-misc/httpie/, net-misc/http-prompt/, ... X-VCS-Repository: dev/dev-zero X-VCS-Files: dev-python/parsimonious/Manifest dev-python/parsimonious/files/parsimonious-0.7.0_pre20151024-python-3-compat.patch dev-python/parsimonious/parsimonious-0.7.0_pre20151024.ebuild net-misc/http-prompt/Manifest net-misc/http-prompt/http-prompt-0.4.2.ebuild net-misc/httpie/Manifest net-misc/httpie/httpie-0.9.4-r1.ebuild net-misc/httpie/metadata.xml X-VCS-Directories: net-misc/http-prompt/ dev-python/parsimonious/files/ net-misc/httpie/ dev-python/parsimonious/ X-VCS-Committer: dev-zero X-VCS-Committer-Name: Tiziano Müller X-VCS-Revision: 3cf0af2f5e87a162538e36fcbc8b47723a9c91d4 X-VCS-Branch: master Date: Wed, 20 Jul 2016 12:23:59 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: d8a82a1e-f542-46f2-a437-518fd79721c7 X-Archives-Hash: f26ec3e9374a86366611e7a338aa9f14 commit: 3cf0af2f5e87a162538e36fcbc8b47723a9c91d4 Author: Tiziano Müller gentoo org> AuthorDate: Wed Jul 20 12:23:51 2016 +0000 Commit: Tiziano Müller gentoo org> CommitDate: Wed Jul 20 12:23:51 2016 +0000 URL: https://gitweb.gentoo.org/dev/dev-zero.git/commit/?id=3cf0af2f net-misc/http-prompt: initial commit + required deps and bumps dev-python/parsimonious/Manifest | 1 + ...monious-0.7.0_pre20151024-python-3-compat.patch | 835 +++++++++++++++++++++ .../parsimonious-0.7.0_pre20151024.ebuild | 33 + net-misc/http-prompt/Manifest | 1 + net-misc/http-prompt/http-prompt-0.4.2.ebuild | 47 ++ net-misc/httpie/Manifest | 3 + net-misc/httpie/httpie-0.9.4-r1.ebuild | 23 + net-misc/httpie/metadata.xml | 19 + 8 files changed, 962 insertions(+) diff --git a/dev-python/parsimonious/Manifest b/dev-python/parsimonious/Manifest new file mode 100644 index 0000000..b135d04 --- /dev/null +++ b/dev-python/parsimonious/Manifest @@ -0,0 +1 @@ +DIST parsimonious-0.7.0_pre20151024.tar.gz 34960 SHA256 88238a0387191bf3ee5d872eb7e467cc9243adf8028272bc7b1f9836774c89f9 SHA512 17617873fbd55abb67746305a66e04300faa3384c8ba1fe9f42069c771c0e01b271fa50873200534c486ea5ef302fdaaa5514e4aae798bce5e8257197d60aacc WHIRLPOOL 1c0dc7b676c917a96c615ae17108b3c47fd6c9dea573390ab8be0b83e4431c16b51753c3e73a16a798dcf9a327f5664e6a1f7be7a824ecf9bb23d5dc0c1122f7 diff --git a/dev-python/parsimonious/files/parsimonious-0.7.0_pre20151024-python-3-compat.patch b/dev-python/parsimonious/files/parsimonious-0.7.0_pre20151024-python-3-compat.patch new file mode 100644 index 0000000..a27e6a2 --- /dev/null +++ b/dev-python/parsimonious/files/parsimonious-0.7.0_pre20151024-python-3-compat.patch @@ -0,0 +1,835 @@ +From 63e7c8faffcfc350a0f96e8654c1c721c0fd1a16 Mon Sep 17 00:00:00 2001 +From: Matthias Urlichs +Date: Sun, 20 Sep 2015 21:07:18 +0200 +Subject: [PATCH 1/8] Add Py3 compatibility. + +All tests pass. +--- + parsimonious/exceptions.py | 13 ++++--- + parsimonious/expressions.py | 9 ++--- + parsimonious/grammar.py | 66 +++++++++++++++++++++------------- + parsimonious/nodes.py | 15 ++++---- + parsimonious/tests/test_expressions.py | 21 +++++------ + parsimonious/tests/test_grammar.py | 3 +- + parsimonious/tests/test_nodes.py | 1 - + parsimonious/utils.py | 15 ++++---- + 8 files changed, 83 insertions(+), 60 deletions(-) + +diff --git a/parsimonious/exceptions.py b/parsimonious/exceptions.py +index f839e24..3e83853 100644 +--- a/parsimonious/exceptions.py ++++ b/parsimonious/exceptions.py +@@ -1,6 +1,7 @@ + from parsimonious.utils import StrAndRepr ++from six import text_type, python_2_unicode_compatible + +- ++@python_2_unicode_compatible + class ParseError(StrAndRepr, Exception): + """A call to ``Expression.parse()`` or ``match()`` didn't match.""" + +@@ -12,9 +13,9 @@ def __init__(self, text, pos=-1, expr=None): + self.pos = pos + self.expr = expr + +- def __unicode__(self): ++ def __str__(self): + rule_name = ((u"'%s'" % self.expr.name) if self.expr.name else +- unicode(self.expr)) ++ text_type(self.expr)) + return u"Rule %s didn't match at '%s' (line %s, column %s)." % ( + rule_name, + self.text[self.pos:self.pos + 20], +@@ -40,11 +41,12 @@ def column(self): + return self.pos + 1 + + ++@python_2_unicode_compatible + class IncompleteParseError(ParseError): + """A call to ``parse()`` matched a whole Expression but did not consume the + entire text.""" + +- def __unicode__(self): ++ def __str__(self): + return u"Rule '%s' matched in its entirety, but it didn't consume all the text. The non-matching portion of the text begins with '%s' (line %s, column %s)." % ( + self.expr.name, + self.text[self.pos:self.pos + 20], +@@ -90,6 +92,7 @@ class BadGrammar(StrAndRepr, Exception): + """ + + ++@python_2_unicode_compatible + class UndefinedLabel(BadGrammar): + """A rule referenced in a grammar was never defined. + +@@ -100,5 +103,5 @@ class UndefinedLabel(BadGrammar): + def __init__(self, label): + self.label = label + +- def __unicode__(self): ++ def __str__(self): + return u'The label "%s" was never defined.' % self.label +diff --git a/parsimonious/expressions.py b/parsimonious/expressions.py +index c503f8b..8bfc143 100644 +--- a/parsimonious/expressions.py ++++ b/parsimonious/expressions.py +@@ -12,7 +12,7 @@ + from parsimonious.exceptions import ParseError, IncompleteParseError + from parsimonious.nodes import Node, RegexNode + from parsimonious.utils import StrAndRepr +- ++from six import integer_types, python_2_unicode_compatible + + MARKER = object() + +@@ -69,7 +69,7 @@ def _uncached_match(self, text, pos, cache, error): + result = (callable(text, pos) if is_simple else + callable(text, pos, cache, error, grammar)) + +- if isinstance(result, (long, int)): ++ if isinstance(result, integer_types): + end, children = result, None + elif isinstance(result, tuple): + end, children = result +@@ -84,6 +84,7 @@ def _as_rhs(self): + return AdHocExpression(name=rule_name) + + ++@python_2_unicode_compatible + class Expression(StrAndRepr): + """A thing that can be matched against a piece of text""" + +@@ -176,7 +177,7 @@ def match_core(self, text, pos, cache, error): + + return node + +- def __unicode__(self): ++ def __str__(self): + return u'<%s %s at 0x%s>' % ( + self.__class__.__name__, + self.as_rule(), +@@ -272,7 +273,7 @@ def _uncached_match(self, text, pos, cache, error): + def _regex_flags_from_bits(self, bits): + """Return the textual equivalent of numerically encoded regex flags.""" + flags = 'tilmsux' +- return ''.join(flags[i] if (1 << i) & bits else '' for i in xrange(6)) ++ return ''.join(flags[i] if (1 << i) & bits else '' for i in range(6)) + + def _as_rhs(self): + # TODO: Get backslash escaping right. +diff --git a/parsimonious/grammar.py b/parsimonious/grammar.py +index 5b95763..36459c6 100644 +--- a/parsimonious/grammar.py ++++ b/parsimonious/grammar.py +@@ -14,8 +14,10 @@ + expression) + from parsimonious.nodes import NodeVisitor + from parsimonious.utils import StrAndRepr, evaluate_string ++from six import text_type, iterkeys, itervalues, iteritems, ++ python_2_unicode_compatible + +- ++@python_2_unicode_compatible + class Grammar(StrAndRepr, Mapping): + """A collection of rules that describe a language + +@@ -62,7 +64,7 @@ def __init__(self, rules='', **more_rules): + decorated_custom_rules = dict( + (k, expression(v, k, self) if isfunction(v) or + ismethod(v) else +- v) for k, v in more_rules.iteritems()) ++ v) for k, v in iteritems(more_rules)) + + self._expressions, first = self._expressions_from_rules(rules, decorated_custom_rules) + self.default_rule = first # may be None +@@ -71,7 +73,7 @@ def __getitem__(self, rule_name): + return self._expressions[rule_name] + + def __iter__(self): +- return self._expressions.iterkeys() ++ return iterkeys(self._expressions) + + def __len__(self): + return len(self._expressions) +@@ -136,11 +138,11 @@ def _check_default_rule(self): + "default rule. Choose a specific rule instead, " + "like some_grammar['some_rule'].parse(...).") + +- def __unicode__(self): ++ def __str__(self): + """Return a rule string that, when passed to the constructor, would + reconstitute the grammar.""" + exprs = [self.default_rule] if self.default_rule else [] +- exprs.extend(expr for expr in self.itervalues() if ++ exprs.extend(expr for expr in itervalues(self) if + expr is not self.default_rule) + return '\n'.join(expr.as_rule() for expr in exprs) + +@@ -264,7 +266,7 @@ def _expressions_from_rules(self, rule_syntax, custom_rules): + ''') + + +-class LazyReference(unicode): ++class LazyReference(text_type): + """A lazy reference to a rule, which we resolve after grokking all the + rules""" + +@@ -296,64 +298,74 @@ def __init__(self, custom_rules=None): + """ + self.custom_rules = custom_rules or {} + +- def visit_parenthesized(self, parenthesized, (left_paren, _1, +- expression, +- right_paren, _2)): ++ def visit_parenthesized(self, parenthesized, _a): + """Treat a parenthesized subexpression as just its contents. + + Its position in the tree suffices to maintain its grouping semantics. + + """ ++ (left_paren, _1, expression, right_paren, _2) = _a + return expression + +- def visit_quantifier(self, quantifier, (symbol, _)): ++ def visit_quantifier(self, quantifier, _a): + """Turn a quantifier into just its symbol-matching node.""" ++ (symbol, _1) = _a + return symbol + +- def visit_quantified(self, quantified, (atom, quantifier)): ++ def visit_quantified(self, quantified, _a): ++ (atom, quantifier) = _a + return self.quantifier_classes[quantifier.text](atom) + +- def visit_lookahead_term(self, lookahead_term, (ampersand, term, _)): ++ def visit_lookahead_term(self, lookahead_term, _a): ++ (ampersand, term, _) = _a + return Lookahead(term) + +- def visit_not_term(self, not_term, (exclamation, term, _)): ++ def visit_not_term(self, not_term, _a): ++ (exclamation, term, _) = _a + return Not(term) + +- def visit_rule(self, rule, (label, equals, expression)): ++ def visit_rule(self, rule, _a): + """Assign a name to the Expression and return it.""" ++ (label, equals, expression) = _a + expression.name = label # Assign a name to the expr. + return expression + +- def visit_sequence(self, sequence, (term, other_terms)): ++ def visit_sequence(self, sequence, _a): + """A parsed Sequence looks like [term node, OneOrMore node of + ``another_term``s]. Flatten it out.""" ++ (term, other_terms) = _a + return Sequence(term, *other_terms) + +- def visit_ored(self, ored, (first_term, other_terms)): ++ def visit_ored(self, ored, _a): ++ (first_term, other_terms) = _a + return OneOf(first_term, *other_terms) + +- def visit_or_term(self, or_term, (slash, _, term)): ++ def visit_or_term(self, or_term, _a): + """Return just the term from an ``or_term``. + + We already know it's going to be ored, from the containing ``ored``. + + """ ++ (slash, _, term) = _a + return term + +- def visit_label(self, label, (name, _)): ++ def visit_label(self, label, _a): + """Turn a label into a unicode string.""" ++ (name, _) = _a + return name.text + +- def visit_reference(self, reference, (label, not_equals)): ++ def visit_reference(self, reference, _a): + """Stick a :class:`LazyReference` in the tree as a placeholder. + + We resolve them all later. + + """ ++ (label, not_equals) = _a + return LazyReference(label) + +- def visit_regex(self, regex, (tilde, literal, flags, _)): ++ def visit_regex(self, regex, _a): + """Return a ``Regex`` expression.""" ++ (tilde, literal, flags, _) = _a + flags = flags.text.upper() + pattern = literal.literal # Pull the string back out of the Literal + # object. +@@ -368,8 +380,9 @@ def visit_spaceless_literal(self, spaceless_literal, visited_children): + """Turn a string literal into a ``Literal`` that recognizes it.""" + return Literal(evaluate_string(spaceless_literal.text)) + +- def visit_literal(self, literal, (spaceless_literal, _)): ++ def visit_literal(self, literal, _a): + """Pick just the literal out of a literal-and-junk combo.""" ++ (spaceless_literal, _) = _a + return spaceless_literal + + def generic_visit(self, node, visited_children): +@@ -401,7 +414,7 @@ def _resolve_refs(self, rule_map, expr, done): + + """ + if isinstance(expr, LazyReference): +- label = unicode(expr) ++ label = text_type(expr) + try: + reffed_expr = rule_map[label] + except KeyError: +@@ -417,7 +430,7 @@ def _resolve_refs(self, rule_map, expr, done): + for member in expr.members] + return expr + +- def visit_rules(self, node, (_, rules)): ++ def visit_rules(self, node, _a): + """Collate all the rules into a map. Return (map, default rule). + + The default rule is the first one. Or, if you have more than one rule +@@ -427,6 +440,8 @@ def visit_rules(self, node, (_, rules)): + due to being kwarg-based, are unordered. + + """ ++ (_, rules) = _a ++ + # Map each rule's name to its Expression. Later rules of the same name + # override earlier ones. This lets us define rules multiple times and + # have the last declaration win, so you can extend grammars by +@@ -441,7 +456,7 @@ def visit_rules(self, node, (_, rules)): + # Resolve references. This tolerates forward references. + done = set() + rule_map = dict((expr.name, self._resolve_refs(rule_map, expr, done)) +- for expr in rule_map.itervalues()) ++ for expr in itervalues(rule_map)) + + # isinstance() is a temporary hack around the fact that * rules don't + # always get transformed into lists by NodeVisitor. We should fix that; +@@ -459,7 +474,8 @@ def visit_spaceless_literal(self, spaceless_literal, visited_children): + ``Token`` objects by their ``type`` attributes.""" + return TokenMatcher(evaluate_string(spaceless_literal.text)) + +- def visit_regex(self, regex, (tilde, literal, flags, _)): ++ def visit_regex(self, regex, _a): ++ (tilde, literal, flags, _) = _a + raise BadGrammar('Regexes do not make sense in TokenGrammars, since ' + 'TokenGrammars operate on pre-lexed tokens rather ' + 'than characters.') +diff --git a/parsimonious/nodes.py b/parsimonious/nodes.py +index 8557855..8f65e17 100644 +--- a/parsimonious/nodes.py ++++ b/parsimonious/nodes.py +@@ -11,8 +11,11 @@ + + from parsimonious.exceptions import VisitationError, UndefinedLabel + from parsimonious.utils import StrAndRepr ++from six import reraise, python_2_unicode_compatible, with_metaclass, ++ iteritems + + ++@python_2_unicode_compatible + class Node(StrAndRepr): + """A parse tree node + +@@ -80,7 +83,7 @@ def indent(text): + ret.append(indent(n.prettily(error=error))) + return '\n'.join(ret) + +- def __unicode__(self): ++ def __str__(self): + """Return a compact, human-readable representation of me.""" + return self.prettily() + +@@ -129,7 +132,7 @@ def unvisit(name): + """Remove any leading "visit_" from a method name.""" + return name[6:] if name.startswith('visit_') else name + +- methods = [v for k, v in namespace.iteritems() if ++ methods = [v for k, v in iteritems(namespace) if + hasattr(v, '_rule') and isfunction(v)] + if methods: + from parsimonious.grammar import Grammar # circular import dodge +@@ -148,7 +151,7 @@ def unvisit(name): + metaclass).__new__(metaclass, name, bases, namespace) + + +-class NodeVisitor(object): ++class NodeVisitor(with_metaclass(RuleDecoratorMeta,object)): + """A shell for writing things that turn parse trees into something useful + + Performs a depth-first traversal of an AST. Subclass this, add methods for +@@ -171,7 +174,6 @@ class NodeVisitor(object): + Heaven forbid you're making it into a string or something else. + + """ +- __metaclass__ = RuleDecoratorMeta + + #: The :term:`default grammar`: the one recommended for use with this + #: visitor. If you populate this, you will be able to call +@@ -215,7 +217,7 @@ def visit(self, node): + # Catch any exception, and tack on a parse tree so it's easier to + # see where it went wrong. + exc_class, exc, tb = exc_info() +- raise VisitationError, (exc, exc_class, node), tb ++ reraise(VisitationError, VisitationError(exc, exc_class, node), tb) + + def generic_visit(self, node, visited_children): + """Default visitor method +@@ -255,8 +257,9 @@ def match(self, text, pos=0): + + # Internal convenience methods to help you write your own visitors: + +- def lift_child(self, node, (first_child,)): ++ def lift_child(self, node, _a): + """Lift the sole child of ``node`` up to replace the node.""" ++ (first_child,) = _a + return first_child + + # Private methods: +diff --git a/parsimonious/tests/test_expressions.py b/parsimonious/tests/test_expressions.py +index 5fe625d..404e67b 100644 +--- a/parsimonious/tests/test_expressions.py ++++ b/parsimonious/tests/test_expressions.py +@@ -8,6 +8,7 @@ + Optional, ZeroOrMore, OneOrMore, Expression) + from parsimonious.grammar import Grammar, rule_grammar + from parsimonious.nodes import Node ++from six import text_type + + + def len_eq(node, length): +@@ -170,7 +171,7 @@ def test_inner_rule_succeeding(self): + eq_(error.pos, 6) + eq_(error.expr, grammar['close_parens']) + eq_(error.text, text) +- eq_(unicode(error), u"Rule 'close_parens' didn't match at '!!' (line 1, column 7).") ++ eq_(text_type(error), "Rule 'close_parens' didn't match at '!!' (line 1, column 7).") + + def test_rewinding(self): + """Make sure rewinding the stack and trying an alternative (which +@@ -216,7 +217,7 @@ def test_parse_with_leftovers(self): + try: + grammar.parse('chitty bangbang') + except IncompleteParseError as error: +- eq_(unicode(error), u"Rule 'sequence' matched in its entirety, but it didn't consume all the text. The non-matching portion of the text begins with 'bang' (line 1, column 12).") ++ eq_(text_type(error), u"Rule 'sequence' matched in its entirety, but it didn't consume all the text. The non-matching portion of the text begins with 'bang' (line 1, column 12).") + + def test_favoring_named_rules(self): + """Named rules should be used in error messages in favor of anonymous +@@ -226,7 +227,7 @@ def test_favoring_named_rules(self): + try: + grammar.parse('burp') + except ParseError as error: +- eq_(unicode(error), u"Rule 'starts_with_a' didn't match at 'burp' (line 1, column 1).") ++ eq_(text_type(error), u"Rule 'starts_with_a' didn't match at 'burp' (line 1, column 1).") + + def test_line_and_column(self): + """Make sure we got the line and column computation right.""" +@@ -240,7 +241,7 @@ def test_line_and_column(self): + except ParseError as error: + # TODO: Right now, this says "Rule + # didn't match". That's not the greatest. Fix that, then fix this. +- ok_(unicode(error).endswith(ur"""didn't match at 'GOO' (line 2, column 4).""")) ++ ok_(text_type(error).endswith(r"""didn't match at 'GOO' (line 2, column 4).""")) + + + class RepresentationTests(TestCase): +@@ -258,7 +259,7 @@ def test_unicode(self): + ``GrammarTests.test_unicode``. + + """ +- unicode(rule_grammar) ++ text_type(rule_grammar) + + def test_unicode_keep_parens(self): + """Make sure converting an expression to unicode doesn't strip +@@ -266,19 +267,19 @@ def test_unicode_keep_parens(self): + + """ + # ZeroOrMore +- eq_(unicode(Grammar('foo = "bar" ("baz" "eggs")* "spam"')), ++ eq_(text_type(Grammar('foo = "bar" ("baz" "eggs")* "spam"')), + u'foo = "bar" ("baz" "eggs")* "spam"') + + # OneOf +- eq_(unicode(Grammar('foo = "bar" ("baz" / "eggs") "spam"')), ++ eq_(text_type(Grammar('foo = "bar" ("baz" / "eggs") "spam"')), + u'foo = "bar" ("baz" / "eggs") "spam"') + + # Lookahead +- eq_(unicode(Grammar('foo = "bar" &("baz" "eggs") "spam"')), ++ eq_(text_type(Grammar('foo = "bar" &("baz" "eggs") "spam"')), + u'foo = "bar" &("baz" "eggs") "spam"') + + # Multiple sequences +- eq_(unicode(Grammar('foo = ("bar" "baz") / ("baff" "bam")')), ++ eq_(text_type(Grammar('foo = ("bar" "baz") / ("baff" "bam")')), + u'foo = ("bar" "baz") / ("baff" "bam")') + + def test_unicode_surrounding_parens(self): +@@ -287,7 +288,7 @@ def test_unicode_surrounding_parens(self): + right-hand side of an expression (as they're unnecessary). + + """ +- eq_(unicode(Grammar('foo = ("foo" ("bar" "baz"))')), ++ eq_(text_type(Grammar('foo = ("foo" ("bar" "baz"))')), + u'foo = "foo" ("bar" "baz")') + + +diff --git a/parsimonious/tests/test_grammar.py b/parsimonious/tests/test_grammar.py +index e9bf070..debb390 100644 +--- a/parsimonious/tests/test_grammar.py ++++ b/parsimonious/tests/test_grammar.py +@@ -9,6 +9,7 @@ + from parsimonious.grammar import rule_grammar, RuleVisitor, Grammar, TokenGrammar, LazyReference + from parsimonious.nodes import Node + from parsimonious.utils import Token ++from six import text_type + + + class BootstrappingGrammarTests(TestCase): +@@ -158,7 +159,7 @@ def test_unicode(self): + bold_open = "((" + bold_close = "))" + """) +- lines = unicode(grammar).splitlines() ++ lines = text_type(grammar).splitlines() + eq_(lines[0], 'bold_text = bold_open text bold_close') + ok_('text = ~"[A-Z 0-9]*"i%s' % ('u' if version_info >= (3,) else '') + in lines) +diff --git a/parsimonious/tests/test_nodes.py b/parsimonious/tests/test_nodes.py +index cd8671c..404aa36 100644 +--- a/parsimonious/tests/test_nodes.py ++++ b/parsimonious/tests/test_nodes.py +@@ -67,7 +67,6 @@ def test_str(): + n = Node('text', 'o hai', 0, 5) + good = '' + eq_(str(n), good) +- eq_(unicode(n), good) + + + def test_repr(): +diff --git a/parsimonious/utils.py b/parsimonious/utils.py +index 1bb9317..5b6f429 100644 +--- a/parsimonious/utils.py ++++ b/parsimonious/utils.py +@@ -2,7 +2,7 @@ + + import ast + from sys import version_info +- ++from six import python_2_unicode_compatible + + class StrAndRepr(object): + """Mix-in to add a ``__str__`` and ``__repr__`` which return the +@@ -10,13 +10,11 @@ class StrAndRepr(object): + + if version_info >= (3,): + # Don't return the "bytes" type from Python 3's __str__: +- def __str__(self): +- return self.__unicode__() ++ def __repr__(self): ++ return self.__str__() + else: +- def __str__(self): +- return self.__unicode__().encode('utf-8') +- +- __repr__ = __str__ # Language spec says must be string, not unicode. ++ def __repr__(self): ++ return self.__str__().encode('utf-8') + + + def evaluate_string(string): +@@ -28,6 +26,7 @@ def evaluate_string(string): + return ast.literal_eval(string) + + ++@python_2_unicode_compatible + class Token(StrAndRepr): + """A class to represent tokens, for use with TokenGrammars + +@@ -42,7 +41,7 @@ class Token(StrAndRepr): + def __init__(self, type): + self.type = type + +- def __unicode__(self): ++ def __str__(self): + return u'' % (self.type,) + + def __eq__(self, other): + +From 51bbab959b5292b08978958db9f8f0908ac423b1 Mon Sep 17 00:00:00 2001 +From: Lucas Wiman +Date: Sun, 29 May 2016 15:31:40 -0700 +Subject: [PATCH 2/8] Update some glue code and fix some bugs + +--- + parsimonious/grammar.py | 2 +- + parsimonious/nodes.py | 2 +- + setup.py | 4 +++- + tox.ini | 3 ++- + 4 files changed, 7 insertions(+), 4 deletions(-) + +diff --git a/parsimonious/grammar.py b/parsimonious/grammar.py +index 36459c6..a2db859 100644 +--- a/parsimonious/grammar.py ++++ b/parsimonious/grammar.py +@@ -14,7 +14,7 @@ + expression) + from parsimonious.nodes import NodeVisitor + from parsimonious.utils import StrAndRepr, evaluate_string +-from six import text_type, iterkeys, itervalues, iteritems, ++from six import text_type, iterkeys, itervalues, iteritems, \ + python_2_unicode_compatible + + @python_2_unicode_compatible +diff --git a/parsimonious/nodes.py b/parsimonious/nodes.py +index 8f65e17..2cf827e 100644 +--- a/parsimonious/nodes.py ++++ b/parsimonious/nodes.py +@@ -11,7 +11,7 @@ + + from parsimonious.exceptions import VisitationError, UndefinedLabel + from parsimonious.utils import StrAndRepr +-from six import reraise, python_2_unicode_compatible, with_metaclass, ++from six import reraise, python_2_unicode_compatible, with_metaclass, \ + iteritems + + +diff --git a/setup.py b/setup.py +index 7e68b1b..fe87b96 100644 +--- a/setup.py ++++ b/setup.py +@@ -25,6 +25,7 @@ + test_suite='nose.collector', + url='https://github.com/erikrose/parsimonious', + include_package_data=True, ++ install_requires=['six'], + classifiers=[ + 'Intended Audience :: Developers', + 'Natural Language :: English', +@@ -37,9 +38,10 @@ + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.2', + 'Programming Language :: Python :: 3.3', ++ 'Programming Language :: Python :: 3.4', ++ 'Programming Language :: Python :: 3.5', + 'Topic :: Scientific/Engineering :: Information Analysis', + 'Topic :: Software Development :: Libraries', + 'Topic :: Text Processing :: General'], + keywords=['parse', 'parser', 'parsing', 'peg', 'packrat', 'grammar', 'language'], +- use_2to3=version_info >= (3,) + ) +diff --git a/tox.ini b/tox.ini +index bba20be..5be2c5b 100644 +--- a/tox.ini ++++ b/tox.ini +@@ -1,7 +1,8 @@ + [tox] +-envlist = py26, py27, py32, py33, py34 ++envlist = py26, py27, py32, py33, py34, py35 + + [testenv] ++usedevelop = True + commands = nosetests parsimonious + deps = nose + # So Python 3 doesn't pick up incompatible, un-2to3'd source from the cwd: + +From bcd2aacacf911f129191ebc21744a09a866ad3de Mon Sep 17 00:00:00 2001 +From: Lucas Wiman +Date: Sun, 29 May 2016 15:37:43 -0700 +Subject: [PATCH 3/8] Add a test for __repr__ py3k incompatibility + +--- + parsimonious/tests/test_grammar.py | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/parsimonious/tests/test_grammar.py b/parsimonious/tests/test_grammar.py +index debb390..2012c05 100644 +--- a/parsimonious/tests/test_grammar.py ++++ b/parsimonious/tests/test_grammar.py +@@ -401,6 +401,9 @@ def mod_grammar(grammar): + grammar.update(new_grammar) + assert_raises(AttributeError, mod_grammar, [grammar]) + ++ def test_repr(self): ++ self.assertTrue(repr(Grammar(r'foo = "a"'))) ++ + + class TokenGrammarTests(TestCase): + """Tests for the TokenGrammar class and associated machinery""" + +From 9b64d3847592cc47123c76a5f132b11a65a23893 Mon Sep 17 00:00:00 2001 +From: Lucas Wiman +Date: Sun, 29 May 2016 15:43:34 -0700 +Subject: [PATCH 4/8] Fix string_escape bug + +--- + parsimonious/grammar.py | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/parsimonious/grammar.py b/parsimonious/grammar.py +index a2db859..cbc711d 100644 +--- a/parsimonious/grammar.py ++++ b/parsimonious/grammar.py +@@ -15,7 +15,7 @@ + from parsimonious.nodes import NodeVisitor + from parsimonious.utils import StrAndRepr, evaluate_string + from six import text_type, iterkeys, itervalues, iteritems, \ +- python_2_unicode_compatible ++ python_2_unicode_compatible, PY2 + + @python_2_unicode_compatible + class Grammar(StrAndRepr, Mapping): +@@ -148,7 +148,8 @@ def __str__(self): + + def __repr__(self): + """Return an expression that will reconstitute the grammar.""" +- return "Grammar('%s')" % str(self).encode('string_escape') ++ codec = 'string_escape' if PY2 else 'unicode_escape' ++ return "Grammar('%s')" % str(self).encode(codec) + + + class TokenGrammar(Grammar): + +From 8e21d91af574a9c9a0b3cc70badd1ce03e9cd91b Mon Sep 17 00:00:00 2001 +From: Lucas Wiman +Date: Sun, 29 May 2016 15:47:36 -0700 +Subject: [PATCH 5/8] Update travis.yml to use tox-travis (hopefully). + +--- + .travis.yml | 15 ++++++++------- + tox.ini | 8 ++++++++ + 2 files changed, 16 insertions(+), 7 deletions(-) + +diff --git a/.travis.yml b/.travis.yml +index d1763e8..328ad9f 100644 +--- a/.travis.yml ++++ b/.travis.yml +@@ -1,11 +1,12 @@ + language: python ++python: ++ - "2.6" ++ - "2.7" ++ - "3.2" ++ - "3.3" ++ - "3.4" ++ - "3.5" + install: +- - pip install tox ++ - pip install tox tox-travis + script: + - tox +-env: +- - TOXENV=py26 +- - TOXENV=py27 +- - TOXENV=py32 +- - TOXENV=py33 +- - TOXENV=py34 +diff --git a/tox.ini b/tox.ini +index 5be2c5b..5448cec 100644 +--- a/tox.ini ++++ b/tox.ini +@@ -1,6 +1,14 @@ + [tox] + envlist = py26, py27, py32, py33, py34, py35 + ++[tox:travis] ++2.6 = py26 ++2.7 = py27 ++3.2 = py32 ++3.3 = py33 ++3.4 = py34 ++3.5 = py35 ++ + [testenv] + usedevelop = True + commands = nosetests parsimonious + +From 26ea616bf3bcdff40bc5210bfdbe29aa517784d1 Mon Sep 17 00:00:00 2001 +From: Lucas Wiman +Date: Sun, 29 May 2016 15:51:15 -0700 +Subject: [PATCH 6/8] Bump version + +--- + setup.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/setup.py b/setup.py +index fe87b96..cde4d70 100644 +--- a/setup.py ++++ b/setup.py +@@ -14,7 +14,7 @@ + + setup( + name='parsimonious', +- version='0.6.2', ++ version='0.7.0', + description='(Soon to be) the fastest pure-Python PEG parser I could muster', + long_description=long_description, + author='Erik Rose', + +From 07851b04db9d803344990dbe8442649bfd77c72c Mon Sep 17 00:00:00 2001 +From: Lucas Wiman +Date: Sun, 29 May 2016 16:00:48 -0700 +Subject: [PATCH 7/8] Drop support for python 3.2 due to pip incompatibility + +--- + .travis.yml | 1 - + tox.ini | 1 - + 2 files changed, 2 deletions(-) + +diff --git a/.travis.yml b/.travis.yml +index 328ad9f..9bc07a0 100644 +--- a/.travis.yml ++++ b/.travis.yml +@@ -2,7 +2,6 @@ language: python + python: + - "2.6" + - "2.7" +- - "3.2" + - "3.3" + - "3.4" + - "3.5" +diff --git a/tox.ini b/tox.ini +index 5448cec..4f76b61 100644 +--- a/tox.ini ++++ b/tox.ini +@@ -4,7 +4,6 @@ envlist = py26, py27, py32, py33, py34, py35 + [tox:travis] + 2.6 = py26 + 2.7 = py27 +-3.2 = py32 + 3.3 = py33 + 3.4 = py34 + 3.5 = py35 + +From 115539cbb590b47c2d64aae8d66209150e723709 Mon Sep 17 00:00:00 2001 +From: Lucas Wiman +Date: Sun, 29 May 2016 16:24:28 -0700 +Subject: [PATCH 8/8] Fix bithacks so that "x" can be displayed. + +--- + parsimonious/expressions.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/parsimonious/expressions.py b/parsimonious/expressions.py +index 8bfc143..0c33fd0 100644 +--- a/parsimonious/expressions.py ++++ b/parsimonious/expressions.py +@@ -272,8 +272,8 @@ def _uncached_match(self, text, pos, cache, error): + + def _regex_flags_from_bits(self, bits): + """Return the textual equivalent of numerically encoded regex flags.""" +- flags = 'tilmsux' +- return ''.join(flags[i] if (1 << i) & bits else '' for i in range(6)) ++ flags = 'ilmsux' ++ return ''.join(flags[i - 1] if (1 << i) & bits else '' for i in range(1, len(flags) + 1)) + + def _as_rhs(self): + # TODO: Get backslash escaping right. diff --git a/dev-python/parsimonious/parsimonious-0.7.0_pre20151024.ebuild b/dev-python/parsimonious/parsimonious-0.7.0_pre20151024.ebuild new file mode 100644 index 0000000..a96c758 --- /dev/null +++ b/dev-python/parsimonious/parsimonious-0.7.0_pre20151024.ebuild @@ -0,0 +1,33 @@ +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=6 + +PYTHON_COMPAT=( python{2_7,3_3,3_4,3_5} ) + +inherit distutils-r1 + +GIT_COMMIT="8030d0f84da4e8c6ddbf49ab5073333284ee54e7" + +DESCRIPTION="Pure-Python PEG parser" +HOMEPAGE="https://github.com/erikrose/parsimonious https://pypi.python.org/pypi/parsimonious" +SRC_URI="https://github.com/erikrose/${PN}/archive/${GIT_COMMIT}.tar.gz -> ${P}.tar.gz" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="test" + +RDEPEND="dev-python/six[${PYTHON_USEDEP}]" +DEPEND="${RDEPEND} + dev-python/setuptools[${PYTHON_USEDEP}] + test? ( dev-python/nose[${PYTHON_USEDEP}] )" + +PATCHES=( "${FILESDIR}/${P}-python-3-compat.patch" ) + +S="${WORKDIR}/${PN}-${GIT_COMMIT}" + +python_test() { + nosetests || die +} diff --git a/net-misc/http-prompt/Manifest b/net-misc/http-prompt/Manifest new file mode 100644 index 0000000..3d885c1 --- /dev/null +++ b/net-misc/http-prompt/Manifest @@ -0,0 +1 @@ +DIST http-prompt-0.4.2.tar.gz 301879 SHA256 22223b18085670d15d96239b23a5ea50b3264b407259b02004d0699e52ec9206 SHA512 2e3e06e1464095712c55da0b3c40162338672935883475e6118a9fa17561b555cc80a1b3696e585b7800a1b7078976fd643aebfe1d1483547f7c8b71b7349813 WHIRLPOOL 30199caee7d6d98485cb2df00506a9f4e2aaf99ae9f4709d5aea1d09ab2083800bf2c8acac91db86db9aeb71ce64dee8d281c09b392af8255b581c9914195633 diff --git a/net-misc/http-prompt/http-prompt-0.4.2.ebuild b/net-misc/http-prompt/http-prompt-0.4.2.ebuild new file mode 100644 index 0000000..4c7460a --- /dev/null +++ b/net-misc/http-prompt/http-prompt-0.4.2.ebuild @@ -0,0 +1,47 @@ +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=6 + +PYTHON_COMPAT=( python{2_7,3_3,3_4,3_5} ) +DISTUTILS_SINGLE_IMPL=1 + +inherit distutils-r1 + +DESCRIPTION="An interactive command-line HTTP client featuring autocomplete and syntax highlighting" +HOMEPAGE="https://github.com/eliangcs/http-prompt" +SRC_URI="https://github.com/eliangcs/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="test" + +RDEPEND=">=dev-python/click-5[${PYTHON_USEDEP}] + >=net-misc/httpie-0.9.2[${PYTHON_USEDEP}] + >=dev-python/parsimonious-0.6.2[${PYTHON_USEDEP}] + >=dev-python/prompt_toolkit-0.60[${PYTHON_USEDEP}] + >=dev-python/pygments-2.1[${PYTHON_USEDEP}] + >=dev-python/six-1.10[${PYTHON_USEDEP}]" +DEPEND="${RDEPEND} + dev-python/setuptools[${PYTHON_USEDEP}] + test? ( + dev-python/mock[${PYTHON_USEDEP}] + dev-python/pexpect[${PYTHON_USEDEP}] + dev-python/pytest[${PYTHON_USEDEP}] + )" + +python_prepare_all() { + # remove tests checking the installation + rm tests/test_{installation,interaction}.py || die + + # remove tox config passing coverage params to py.test + rm tox.ini || die + + distutils-r1_python_prepare_all +} + +python_test() { + py.test tests || die +} diff --git a/net-misc/httpie/Manifest b/net-misc/httpie/Manifest new file mode 100644 index 0000000..275800b --- /dev/null +++ b/net-misc/httpie/Manifest @@ -0,0 +1,3 @@ +DIST httpie-0.9.2.tar.gz 73153 SHA256 af3982d41743d986608f1fe6e437d0493df227993c7edf013cc1d61883d40d68 SHA512 5622caa2f3136137d85f91eba9b0a165ec987b696a5e001844c8ecb868d66cfc86b3f3fb3a1ac493d7603c67ca88de0e0ffc776dce855ad69364190607b4fb73 WHIRLPOOL e8a4aa09f7051176ee0340b6f6785bb57353bd4bf8c0dea66b9dc50a1e6aea254eafc7d54e128c78d6fdca2f44338bfcfe6f7aca7623dbf0cd5a7b79c9d1c739 +DIST httpie-0.9.3.tar.gz 73693 SHA256 30a8ff2a72b75cb6033cc84f5b76c336999f91c325f169e78dc6339351ee7f4b SHA512 a98aa19ddcc5223133f1081ce22457d21b838b5779788a08d0b65ea80f903ab577a55e0c73b3656486eec08c3c0910d3e987aed0f117c5f9b3e005c6001000cc WHIRLPOOL a25f0d89339c468eafb3cf79d4aa6e323f3346ced921f6ee907771265577347969185f797022d51f9f037065d1b9c82e366789b40084874b390b9aa39f30084c +DIST httpie-0.9.4.tar.gz 79889 SHA256 0fc288a85d6c018c64bbc86dfcc9c7fad063e79816840dfa91e8d6c43654761e SHA512 eea4e0fce334d12f9438d89f87d119bc569f8042d95c87f6898b9110030674f49361bf8e119d815330aa117479557766d614510d81c42c9c3a6803c769f38b26 WHIRLPOOL 2a9bb6b45d8b5d62a1118aa09eb0fd4612b56b8fe158c9d8a5295dc3b53e52906afb9888e6724528b19a2b2738f43cc2eb4a124caacf8c1df93056315a1ab87f diff --git a/net-misc/httpie/httpie-0.9.4-r1.ebuild b/net-misc/httpie/httpie-0.9.4-r1.ebuild new file mode 100644 index 0000000..4c8cafe --- /dev/null +++ b/net-misc/httpie/httpie-0.9.4-r1.ebuild @@ -0,0 +1,23 @@ +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=6 + +PYTHON_COMPAT=( python{2_7,3_3,3_4,3_5} ) + +inherit distutils-r1 + +DESCRIPTION="A CLI, cURL-like tool for humans" +HOMEPAGE="http://httpie.org/ https://pypi.python.org/pypi/httpie" +SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz" + +LICENSE="BSD" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="" + +DEPEND="" +RDEPEND="${DEPEND} + >=dev-python/requests-2.3.0[${PYTHON_USEDEP}] + >=dev-python/pygments-1.5[${PYTHON_USEDEP}]" diff --git a/net-misc/httpie/metadata.xml b/net-misc/httpie/metadata.xml new file mode 100644 index 0000000..34aed7f --- /dev/null +++ b/net-misc/httpie/metadata.xml @@ -0,0 +1,19 @@ + + + + + vikraman@gentoo.org + Vikraman Choudhury + + + HTTPie is a command line HTTP client. Its goal is to make CLI + interaction with web services as human-friendly as possible. It + provides a simple http command that allows for sending arbitrary HTTP + requests using a simple and natural syntax, and displays colorized + responses. HTTPie can be used for testing, debugging, and generally + interacting with HTTP servers. + + + httpie + +