Commit 6951ddf2 authored by Jason R. Coombs's avatar Jason R. Coombs Committed by GitHub

Merge pull request #854 from stepshal/packaging

Upgrade packaging to 16.8
parents ebe23daa 03b00c2b
......@@ -12,7 +12,7 @@ __title__ = "packaging"
__summary__ = "Core utilities for Python packages"
__uri__ = "https://github.com/pypa/packaging"
__version__ = "16.7"
__version__ = "16.8"
__author__ = "Donald Stufft and individual contributors"
__email__ = "donald@stufft.io"
......
......@@ -52,13 +52,26 @@ class Node(object):
def __repr__(self):
return "<{0}({1!r})>".format(self.__class__.__name__, str(self))
def serialize(self):
raise NotImplementedError
class Variable(Node):
pass
def serialize(self):
return str(self)
class Value(Node):
pass
def serialize(self):
return '"{0}"'.format(self)
class Op(Node):
def serialize(self):
return str(self)
VARIABLE = (
......@@ -103,6 +116,7 @@ VERSION_CMP = (
)
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.setParseAction(lambda s, l, t: Value(t[0]))
......@@ -149,7 +163,7 @@ def _format_marker(marker, first=True):
else:
return "(" + " ".join(inner) + ")"
elif isinstance(marker, tuple):
return '{0} {1} "{2}"'.format(*marker)
return " ".join([m.serialize() for m in marker])
else:
return marker
......@@ -168,13 +182,13 @@ _operators = {
def _eval_op(lhs, op, rhs):
try:
spec = Specifier("".join([op, rhs]))
spec = Specifier("".join([op.serialize(), rhs]))
except InvalidSpecifier:
pass
else:
return spec.contains(lhs)
oper = _operators.get(op)
oper = _operators.get(op.serialize())
if oper is None:
raise UndefinedComparison(
"Undefined {0!r} on {1!r} and {2!r}.".format(op, lhs, rhs)
......
packaging==16.7
packaging==16.8
pyparsing==2.1.10
six==1.10.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