aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2015-01-07 18:35:48 -0500
committerJason R. Coombs <jaraco@jaraco.com>2015-01-07 18:35:48 -0500
commitf96d9006080ad816cd492b7769c3d3b1d9206f72 (patch)
treebbb499d618d2a5313adc3f5c2f6c7d037265ce2e
parent81df10c70a695360683d76daa1737ba3feb56f6f (diff)
parenta8f60a73238ae67e0c5a04e437fd9f4edf08bbd6 (diff)
downloadexternal_python_setuptools-f96d9006080ad816cd492b7769c3d3b1d9206f72.tar.gz
external_python_setuptools-f96d9006080ad816cd492b7769c3d3b1d9206f72.tar.bz2
external_python_setuptools-f96d9006080ad816cd492b7769c3d3b1d9206f72.zip
Merge with 11.3.1
-rw-r--r--.hgtags3
-rw-r--r--CHANGES.txt31
-rw-r--r--ez_setup.py2
-rw-r--r--linkify.py2
-rw-r--r--pkg_resources/__init__.py25
-rw-r--r--pkg_resources/tests/test_resources.py23
-rw-r--r--setuptools/command/test.py2
-rw-r--r--setuptools/dist.py2
-rw-r--r--setuptools/tests/test_sdist.py2
-rw-r--r--setuptools/version.py2
10 files changed, 72 insertions, 22 deletions
diff --git a/.hgtags b/.hgtags
index 021c8ff4..343bfa9e 100644
--- a/.hgtags
+++ b/.hgtags
@@ -183,3 +183,6 @@ fa069bf2411a150c9379d31a04d1c3836e2d3027 9.0.1
1f5de53c079d577ead9d80265c9e006503b16457 10.2.1
b4b92805bc0e9802da0b597d00df4fa42b30bc40 11.0
6cd2b18f4be2a9c188fa505b34505b32f4a4554b 11.1
+feb5971e7827483bbdeb67613126bb79ed09e6d9 11.2
+a1a6a1ac9113b90009052ca7263174a488434099 11.3
+1116e568f534ad8f4f41328a0f5fa183eb739c90 11.3.1
diff --git a/CHANGES.txt b/CHANGES.txt
index d6cf236a..afec8156 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -11,6 +11,33 @@ CHANGES
be specified. This means that systems with a specified executable whose name
has spaces in the path must be updated to escape or quote that value.
+------
+11.3.1
+------
+
+* Issue #327: Formalize and restore support for any printable character in an
+ entry point name.
+
+----
+11.3
+----
+
+* Expose ``EntryPoint.resolve`` in place of EntryPoint._load, implementing the
+ simple, non-requiring load. Deprecated all uses of ``EntryPoint._load``
+ except for calling with no parameters, which is just a shortcut for
+ ``ep.require(); ep.resolve();``.
+
+ Apps currently invoking ``ep.load(require=False)`` should instead do the
+ following if wanting to avoid the deprecating warning::
+
+ getattr(ep, "resolve", lambda: ep.load(require=False))()
+
+----
+11.2
+----
+
+* Pip #2326: Report deprecation warning at stacklevel 2 for easier diagnosis.
+
----
11.1
----
@@ -39,7 +66,9 @@ CHANGES
10.2
----
-* Deprecated use of EntryPoint.load(require=False).
+* Deprecated use of EntryPoint.load(require=False). Passing a boolean to a
+ function to select behavior is an anti-pattern. Instead use
+ ``Entrypoint._load()``.
* Substantial refactoring of all unit tests. Tests are now much leaner and
re-use a lot of fixtures and contexts for better clarity of purpose.
diff --git a/ez_setup.py b/ez_setup.py
index 388ff490..f1e4aeae 100644
--- a/ez_setup.py
+++ b/ez_setup.py
@@ -36,7 +36,7 @@ try:
except ImportError:
USER_SITE = None
-DEFAULT_VERSION = "11.2"
+DEFAULT_VERSION = "11.3.2"
DEFAULT_URL = "https://pypi.python.org/packages/source/s/setuptools/"
def _python_cmd(*args):
diff --git a/linkify.py b/linkify.py
index e7b3ca7b..5c6e16b4 100644
--- a/linkify.py
+++ b/linkify.py
@@ -15,6 +15,7 @@ link_patterns = [
r"Jython #(?P<jython>\d+)",
r"Python #(?P<python>\d+)",
r"Interop #(?P<interop>\d+)",
+ r"Pip #(?P<pip>\d+)",
]
issue_urls = dict(
@@ -27,6 +28,7 @@ issue_urls = dict(
jython='http://bugs.jython.org/issue{jython}',
python='http://bugs.python.org/issue{python}',
interop='https://github.com/pypa/interoperability-peps/issues/{interop}',
+ pip='https://github.com/pypa/pip/issues/{pip}',
)
diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py
index d51f301b..c0c095b2 100644
--- a/pkg_resources/__init__.py
+++ b/pkg_resources/__init__.py
@@ -2294,18 +2294,25 @@ class EntryPoint(object):
def __repr__(self):
return "EntryPoint.parse(%r)" % str(self)
- def load(self, require=True, env=None, installer=None):
- if require:
- self.require(env, installer)
- else:
+ def load(self, require=True, *args, **kwargs):
+ """
+ Require packages for this EntryPoint, then resolve it.
+ """
+ if not require or args or kwargs:
warnings.warn(
- "`require` parameter is deprecated. Use "
- "EntryPoint._load instead.",
+ "Parameters to load are deprecated. Call .resolve and "
+ ".require separately.",
DeprecationWarning,
+ stacklevel=2,
)
- return self._load()
+ if require:
+ self.require(*args, **kwargs)
+ return self.resolve()
- def _load(self):
+ def resolve(self):
+ """
+ Resolve the entry point from its module and attrs.
+ """
module = __import__(self.module_name, fromlist=['__name__'], level=0)
try:
return functools.reduce(getattr, self.attrs, module)
@@ -2321,7 +2328,7 @@ class EntryPoint(object):
pattern = re.compile(
r'\s*'
- r'(?P<name>[+\w. -]+?)\s*'
+ r'(?P<name>.+?)\s*'
r'=\s*'
r'(?P<module>[\w.]+)\s*'
r'(:\s*(?P<attr>[\w.]+))?\s*'
diff --git a/pkg_resources/tests/test_resources.py b/pkg_resources/tests/test_resources.py
index f252ddff..a55478a2 100644
--- a/pkg_resources/tests/test_resources.py
+++ b/pkg_resources/tests/test_resources.py
@@ -2,6 +2,7 @@ import os
import sys
import tempfile
import shutil
+import string
import pytest
@@ -294,13 +295,21 @@ class TestEntryPoints:
ep = EntryPoint.parse(spec)
assert ep.name == 'html+mako'
- def testRejects(self):
- for ep in [
- "foo", "x=1=2", "x=a:b:c", "q=x/na", "fez=pish:tush-z", "x=f[a]>2",
- ]:
- try: EntryPoint.parse(ep)
- except ValueError: pass
- else: raise AssertionError("Should've been bad", ep)
+ reject_specs = "foo", "x=a:b:c", "q=x/na", "fez=pish:tush-z", "x=f[a]>2"
+ @pytest.mark.parametrize("reject_spec", reject_specs)
+ def test_reject_spec(self, reject_spec):
+ with pytest.raises(ValueError):
+ EntryPoint.parse(reject_spec)
+
+ def test_printable_name(self):
+ """
+ Allow any printable character in the name.
+ """
+ # Create a name with all printable characters; strip the whitespace.
+ name = string.printable.strip()
+ spec = "{name} = module:attr".format(**locals())
+ ep = EntryPoint.parse(spec)
+ assert ep.name == name
def checkSubMap(self, m):
assert len(m) == len(self.submap_expect)
diff --git a/setuptools/command/test.py b/setuptools/command/test.py
index 2bf5cb16..42689f70 100644
--- a/setuptools/command/test.py
+++ b/setuptools/command/test.py
@@ -172,4 +172,4 @@ class test(Command):
if val is None:
return
parsed = EntryPoint.parse("x=" + val)
- return parsed._load()()
+ return parsed.resolve()()
diff --git a/setuptools/dist.py b/setuptools/dist.py
index 1917a610..bc29b131 100644
--- a/setuptools/dist.py
+++ b/setuptools/dist.py
@@ -434,7 +434,7 @@ class Distribution(_Distribution):
for ep in pkg_resources.iter_entry_points('distutils.commands'):
if ep.name not in self.cmdclass:
# don't require extras as the commands won't be invoked
- cmdclass = ep._load()
+ cmdclass = ep.resolve()
self.cmdclass[ep.name] = cmdclass
return _Distribution.print_commands(self)
diff --git a/setuptools/tests/test_sdist.py b/setuptools/tests/test_sdist.py
index d3494d7a..9013b505 100644
--- a/setuptools/tests/test_sdist.py
+++ b/setuptools/tests/test_sdist.py
@@ -415,5 +415,5 @@ def test_default_revctrl():
"""
ep_def = 'svn_cvs = setuptools.command.sdist:_default_revctrl'
ep = pkg_resources.EntryPoint.parse(ep_def)
- res = ep._load()
+ res = ep.resolve()
assert hasattr(res, '__iter__')
diff --git a/setuptools/version.py b/setuptools/version.py
index a6fd3e36..1e71f92d 100644
--- a/setuptools/version.py
+++ b/setuptools/version.py
@@ -1 +1 @@
-__version__ = '11.2'
+__version__ = '11.3.2'