Commit ba5633b3 authored by Steve Kowalik's avatar Steve Kowalik

Switch back to SyntaxError for invalid markers, stops consumers having to...

Switch back to SyntaxError for invalid markers, stops consumers having to import packaging themselves
parent 7e1ca274
...@@ -1395,7 +1395,7 @@ def invalid_marker(text): ...@@ -1395,7 +1395,7 @@ def invalid_marker(text):
""" """
try: try:
evaluate_marker(text) evaluate_marker(text)
except packaging.markers.InvalidMarker as e: except SyntaxError as e:
e.filename = None e.filename = None
e.lineno = None e.lineno = None
return e return e
...@@ -1406,12 +1406,15 @@ def evaluate_marker(text, extra=None): ...@@ -1406,12 +1406,15 @@ def evaluate_marker(text, extra=None):
""" """
Evaluate a PEP 508 environment marker. Evaluate a PEP 508 environment marker.
Return a boolean indicating the marker result in this environment. Return a boolean indicating the marker result in this environment.
Raise InvalidMarker if marker is invalid. Raise SyntaxError if marker is invalid.
This implementation uses the 'pyparsing' module. This implementation uses the 'pyparsing' module.
""" """
marker = packaging.markers.Marker(text) marker = packaging.markers.Marker(text)
return marker.evaluate() try:
return marker.evaluate()
except packaging.marker.InvalidMarker as e:
raise SyntaxError(e)
class NullProvider: class NullProvider:
......
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