Skip to content

Commit 1452b29

Browse files
committed
Render a nicer error message when list addition is encountered.
1 parent f6df907 commit 1452b29

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/zope/meta/setup_to_pyproject.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ def parse_setup_function(ast_node, assigned_names=None):
6464
if isinstance(value, ast.Name):
6565
gathered[key.value] = assigned_names.get(value.id, '')
6666
elif isinstance(value, ast.BinOp):
67+
if isinstance(value.left, ast.List):
68+
# e. g. "['Sphinx'] + BROWSER_REQUIRES"
69+
print('XXX Cannot convert list addition XXX')
70+
print('XXX Please fix setup.py manually first XXX')
71+
print('XXX list addition: '
72+
f'{ast.unparse(value)} XXX')
73+
sys.exit(1)
6774
# Interpolated string 'x%sy' % foo
6875
unformatted = value.left.value
6976
variable = assigned_names.get(value.right.id, '')

0 commit comments

Comments
 (0)