diff --git a/distlib/util.py b/distlib/util.py index d29ac6b..bc09ab5 100644 --- a/distlib/util.py +++ b/distlib/util.py @@ -707,7 +707,7 @@ def __eq__(self, other): __hash__ = object.__hash__ -ENTRY_RE = re.compile(r'''(?P(\w|[-.+])+) +ENTRY_RE = re.compile(r'''(?P([^\[]\S*)) \s*=\s*(?P(\w+)([:\.]\w+)*) \s*(\[\s*(?P[\w-]+(=\w+)?(,\s*\w+(=\w+)?)*)\s*\])? ''', re.VERBOSE) diff --git a/tests/test_util.py b/tests/test_util.py index 6f24ef4..b51e5b9 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -74,6 +74,12 @@ def test_export_entry(self): self.check_entry(get_export_entry('foo=abc'), 'foo', 'abc', None, []) self.check_entry(get_export_entry('smc++ = smcpp.frontend:console'), 'smc++', 'smcpp.frontend', 'console', []) + # See issue #203 - correct name parsing to allow non-name-like names like "," + self.check_entry(get_export_entry(', = comma:main'), ',', + 'comma', 'main', []) + self.check_entry(get_export_entry(',comma = comma:main'), ',comma', + 'comma', 'main', []) + self.assertRaises(DistlibException, get_export_entry, 'foo=foo.bar:x:y') self.assertRaises(DistlibException, get_export_entry, 'foo=foo.bar:x [') self.assertRaises(DistlibException, get_export_entry, 'foo=foo.bar:x ]')