Make error message more informative

It's easier to identify a malformed variable assignment if we print it
out.
pull/2063/head
Emmanuele Bassi 7 years ago committed by Jussi Pakkanen
parent 26834a6198
commit 381e8313ed
  1. 4
      mesonbuild/modules/pkgconfig.py

@ -155,11 +155,11 @@ class PkgConfigModule(ExtensionModule):
# foo=bar=baz is ('foo', 'bar=baz') # foo=bar=baz is ('foo', 'bar=baz')
l = var.split('=', 1) l = var.split('=', 1)
if len(l) < 2: if len(l) < 2:
raise mesonlib.MesonException('Variables must be in \'name=value\' format') raise mesonlib.MesonException('Invalid variable "{}". Variables must be in \'name=value\' format'.format(var))
name, value = l[0].strip(), l[1].strip() name, value = l[0].strip(), l[1].strip()
if not name or not value: if not name or not value:
raise mesonlib.MesonException('Variables must be in \'name=value\' format') raise mesonlib.MesonException('Invalid variable "{}". Variables must be in \'name=value\' format'.format(var))
# Variable names must not contain whitespaces # Variable names must not contain whitespaces
if any(c.isspace() for c in name): if any(c.isspace() for c in name):

Loading…
Cancel
Save