diff options
| -rw-r--r-- | CHANGES.txt | 7 | ||||
| -rw-r--r-- | pkg_resources/__init__.py | 2 | ||||
| -rw-r--r-- | pkg_resources/tests/test_resources.py | 11 |
3 files changed, 19 insertions, 1 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index ab93a9c6..5fce5d9c 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -2,6 +2,13 @@ CHANGES ======= +------ +11.3.1 +------ + +* Issue #327: Formalize and restore support for any printable character in an + entry point name. + ---- 11.3 ---- diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py index fd8efaa8..c0c095b2 100644 --- a/pkg_resources/__init__.py +++ b/pkg_resources/__init__.py @@ -2328,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..4a82167b 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 @@ -302,6 +303,16 @@ class TestEntryPoints: except ValueError: pass else: raise AssertionError("Should've been bad", ep) + 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) for key, ep in pkg_resources.iteritems(self.submap_expect): |
