Commit 03b00c2b authored by stepshal's avatar stepshal

Upgrade packaging to 16.8

parent e8d53c0b
...@@ -12,7 +12,7 @@ __title__ = "packaging" ...@@ -12,7 +12,7 @@ __title__ = "packaging"
__summary__ = "Core utilities for Python packages" __summary__ = "Core utilities for Python packages"
__uri__ = "https://github.com/pypa/packaging" __uri__ = "https://github.com/pypa/packaging"
__version__ = "16.7" __version__ = "16.8"
__author__ = "Donald Stufft and individual contributors" __author__ = "Donald Stufft and individual contributors"
__email__ = "donald@stufft.io" __email__ = "donald@stufft.io"
......
...@@ -52,13 +52,26 @@ class Node(object): ...@@ -52,13 +52,26 @@ class Node(object):
def __repr__(self): def __repr__(self):
return "<{0}({1!r})>".format(self.__class__.__name__, str(self)) return "<{0}({1!r})>".format(self.__class__.__name__, str(self))
def serialize(self):
raise NotImplementedError
class Variable(Node): class Variable(Node):
pass
def serialize(self):
return str(self)
class Value(Node): class Value(Node):
pass
def serialize(self):
return '"{0}"'.format(self)
class Op(Node):
def serialize(self):
return str(self)
VARIABLE = ( VARIABLE = (
...@@ -103,6 +116,7 @@ VERSION_CMP = ( ...@@ -103,6 +116,7 @@ VERSION_CMP = (
) )
MARKER_OP = VERSION_CMP | L("not in") | L("in") MARKER_OP = VERSION_CMP | L("not in") | L("in")
MARKER_OP.setParseAction(lambda s, l, t: Op(t[0]))
MARKER_VALUE = QuotedString("'") | QuotedString('"') MARKER_VALUE = QuotedString("'") | QuotedString('"')
MARKER_VALUE.setParseAction(lambda s, l, t: Value(t[0])) MARKER_VALUE.setParseAction(lambda s, l, t: Value(t[0]))
...@@ -149,7 +163,7 @@ def _format_marker(marker, first=True): ...@@ -149,7 +163,7 @@ def _format_marker(marker, first=True):
else: else:
return "(" + " ".join(inner) + ")" return "(" + " ".join(inner) + ")"
elif isinstance(marker, tuple): elif isinstance(marker, tuple):
return '{0} {1} "{2}"'.format(*marker) return " ".join([m.serialize() for m in marker])
else: else:
return marker return marker
...@@ -168,13 +182,13 @@ _operators = { ...@@ -168,13 +182,13 @@ _operators = {
def _eval_op(lhs, op, rhs): def _eval_op(lhs, op, rhs):
try: try:
spec = Specifier("".join([op, rhs])) spec = Specifier("".join([op.serialize(), rhs]))
except InvalidSpecifier: except InvalidSpecifier:
pass pass
else: else:
return spec.contains(lhs) return spec.contains(lhs)
oper = _operators.get(op) oper = _operators.get(op.serialize())
if oper is None: if oper is None:
raise UndefinedComparison( raise UndefinedComparison(
"Undefined {0!r} on {1!r} and {2!r}.".format(op, lhs, rhs) "Undefined {0!r} on {1!r} and {2!r}.".format(op, lhs, rhs)
......
packaging==16.7 packaging==16.8
pyparsing==2.1.10 pyparsing==2.1.10
six==1.10.0 six==1.10.0
appdirs==1.4.0 appdirs==1.4.0
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment