You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
552 B
17 lines
552 B
6 years ago
|
try:
|
||
|
import ast
|
||
|
from _markerlib.markers import default_environment, compile, interpret
|
||
|
except ImportError:
|
||
|
if 'ast' in globals():
|
||
|
raise
|
||
|
def default_environment():
|
||
|
return {}
|
||
|
def compile(marker):
|
||
|
def marker_fn(environment=None, override=None):
|
||
|
# 'empty markers are True' heuristic won't install extra deps.
|
||
|
return not marker.strip()
|
||
|
marker_fn.__doc__ = marker
|
||
|
return marker_fn
|
||
|
def interpret(marker, environment=None, override=None):
|
||
|
return compile(marker)()
|