Commits

Daniel Holth committed c4fe090

Include 'empty marker' heuristic in markerlib itself

  • Participants
  • Parent commits f06e7e8

Comments (0)

Files changed (3)

+0.5.1
+=====
+- Include 'empty marker' heuristic in markerlib itself
+
 0.5
 ===
 - One final release until it's just a part of distribute

File markerlib/__init__.py

-from markerlib.markers import default_environment, compile, interpret
+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)()
 CHANGES = open(os.path.join(here, 'CHANGES.txt')).read()
 
 setup(name='markerlib',
-      version='0.5',
+      version='0.5.1',
       description='A compiler for PEP 345 environment markers.',
       long_description=README + '\n\n' +  CHANGES,
       classifiers=[
         "Programming Language :: Python",
         "Programming Language :: Python :: 2",
         "Programming Language :: Python :: 3",
+        "Programming Language :: Python :: 2.4",
+        "Programming Language :: Python :: 2.5",
         "Programming Language :: Python :: 2.6",
         "Programming Language :: Python :: 2.7",
         "Programming Language :: Python :: 3.2",