aboutsummaryrefslogtreecommitdiffstats
path: root/pkg_resources.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2013-06-08 12:08:18 -0400
committerJason R. Coombs <jaraco@jaraco.com>2013-06-08 12:08:18 -0400
commit468bb206e7a97aecb6df3cfec463b77c94acaf9c (patch)
tree2a3eddb6c12608a460d5fc2e2f823bb8bf354103 /pkg_resources.py
parent34160eb2ed3da6bf4f57c882ccdd5d6fab3bc76b (diff)
downloadexternal_python_setuptools-468bb206e7a97aecb6df3cfec463b77c94acaf9c.tar.gz
external_python_setuptools-468bb206e7a97aecb6df3cfec463b77c94acaf9c.tar.bz2
external_python_setuptools-468bb206e7a97aecb6df3cfec463b77c94acaf9c.zip
Expand documentation on evaluate_marker and indicate its legacy status.
Diffstat (limited to 'pkg_resources.py')
-rw-r--r--pkg_resources.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/pkg_resources.py b/pkg_resources.py
index ea6cf8bb..4dbbba59 100644
--- a/pkg_resources.py
+++ b/pkg_resources.py
@@ -1211,8 +1211,16 @@ def invalid_marker(text):
return sys.exc_info()[1]
return False
-def evaluate_marker(text, extra=None, _ops={}):
- """Evaluate a PEP 426 environment marker; SyntaxError if marker is invalid"""
+def _evaluate_marker_legacy(text, extra=None, _ops={}):
+ """
+ Evaluate a PEP 426 environment marker on CPython 2.4+.
+ Return a boolean indicating the marker result in this environment.
+ Raise SyntaxError if marker is invalid.
+
+ This implementation uses the 'parser' module, which is not implemented on
+ Jython and has been superseded by the 'ast' module in Python 2.6 and
+ later.
+ """
if not _ops:
@@ -1292,6 +1300,7 @@ def evaluate_marker(text, extra=None, _ops={}):
import parser
return interpret(parser.expr(text).totuple(1)[1])
+evaluate_marker = _evaluate_marker_legacy
class NullProvider:
"""Try to implement resources and metadata for arbitrary PEP 302 loaders"""