diff options
author | Daniel Holth <dholth@fastmail.fm> | 2012-08-27 19:11:13 -0400 |
---|---|---|
committer | Daniel Holth <dholth@fastmail.fm> | 2012-08-27 19:11:13 -0400 |
commit | 165f95218ab30580eafba4e2571e03ed14ca482f (patch) | |
tree | eeebebda4a94d3d4409222378d9dca992da31316 /_markerlib | |
parent | 9ebbe014df37c19976a5a9cb0ac2fa228a03144a (diff) | |
download | external_python_setuptools-165f95218ab30580eafba4e2571e03ed14ca482f.tar.gz external_python_setuptools-165f95218ab30580eafba4e2571e03ed14ca482f.tar.bz2 external_python_setuptools-165f95218ab30580eafba4e2571e03ed14ca482f.zip |
move Python < 2.6 fallback into _markerlib
--HG--
branch : distribute
extra : rebase_source : 901265cef35594b3ab20ae4ba3b270a5da6f9ea7
Diffstat (limited to '_markerlib')
-rw-r--r-- | _markerlib/__init__.py | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/_markerlib/__init__.py b/_markerlib/__init__.py index a7b26037..d13e4d5a 100644 --- a/_markerlib/__init__.py +++ b/_markerlib/__init__.py @@ -1,2 +1,16 @@ -"""Used by pkg_resources to interpret PEP 345 environment markers.""" -from _markerlib.markers import default_environment, compile, interpret, as_function +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)() |