Skip to content

Commit ac36501

Browse files
committed
Fix #203: Handle name parsing of export entries correctly.
1 parent a59c714 commit ac36501

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

distlib/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@ def __eq__(self, other):
707707
__hash__ = object.__hash__
708708

709709

710-
ENTRY_RE = re.compile(r'''(?P<name>(\w|[-.+])+)
710+
ENTRY_RE = re.compile(r'''(?P<name>([^\[]\S*))
711711
\s*=\s*(?P<callable>(\w+)([:\.]\w+)*)
712712
\s*(\[\s*(?P<flags>[\w-]+(=\w+)?(,\s*\w+(=\w+)?)*)\s*\])?
713713
''', re.VERBOSE)

tests/test_util.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ def test_export_entry(self):
7474
self.check_entry(get_export_entry('foo=abc'), 'foo', 'abc', None, [])
7575
self.check_entry(get_export_entry('smc++ = smcpp.frontend:console'), 'smc++',
7676
'smcpp.frontend', 'console', [])
77+
# See issue #203 - correct name parsing to allow non-name-like names like ","
78+
self.check_entry(get_export_entry(', = comma:main'), ',',
79+
'comma', 'main', [])
80+
self.check_entry(get_export_entry(',comma = comma:main'), ',comma',
81+
'comma', 'main', [])
82+
7783
self.assertRaises(DistlibException, get_export_entry, 'foo=foo.bar:x:y')
7884
self.assertRaises(DistlibException, get_export_entry, 'foo=foo.bar:x [')
7985
self.assertRaises(DistlibException, get_export_entry, 'foo=foo.bar:x ]')

0 commit comments

Comments
 (0)