aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/mesonlib.py
diff options
context:
space:
mode:
authorDaniel Mensinger <daniel@mensinger-ka.de>2019-04-23 14:58:18 +0200
committerDaniel Mensinger <daniel@mensinger-ka.de>2019-04-29 12:17:40 +0200
commite75211d321d7416b8a4871d3015a7915fb86b53b (patch)
treee6460b95e475fe7fabbb47ee318160ecb6228357 /mesonbuild/mesonlib.py
parentbf98ffca9ee67a6a942b9abf96b536692370cf03 (diff)
downloadmeson-e75211d321d7416b8a4871d3015a7915fb86b53b.zip
meson-e75211d321d7416b8a4871d3015a7915fb86b53b.tar.gz
meson-e75211d321d7416b8a4871d3015a7915fb86b53b.tar.bz2
Fix builtin variable names
Diffstat (limited to 'mesonbuild/mesonlib.py')
-rw-r--r--mesonbuild/mesonlib.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py
index 7219946..d5e60fd 100644
--- a/mesonbuild/mesonlib.py
+++ b/mesonbuild/mesonlib.py
@@ -722,11 +722,11 @@ def has_path_sep(name, sep='/\\'):
return True
return False
-def do_replacement(regex, line, format, confdata):
+def do_replacement(regex, line, variable_format, confdata):
missing_variables = set()
start_tag = '@'
backslash_tag = '\\@'
- if format == 'cmake':
+ if variable_format == 'cmake':
start_tag = '${'
backslash_tag = '\\${'
@@ -779,7 +779,7 @@ def do_mesondefine(line, confdata):
raise MesonException('#mesondefine argument "%s" is of unknown type.' % varname)
-def do_conf_file(src, dst, confdata, format, encoding='utf-8'):
+def do_conf_file(src, dst, confdata, variable_format, encoding='utf-8'):
try:
with open(src, encoding=encoding, newline='') as f:
data = f.readlines()
@@ -787,15 +787,15 @@ def do_conf_file(src, dst, confdata, format, encoding='utf-8'):
raise MesonException('Could not read input file %s: %s' % (src, str(e)))
# Only allow (a-z, A-Z, 0-9, _, -) as valid characters for a define
# Also allow escaping '@' with '\@'
- if format in ['meson', 'cmake@']:
+ if variable_format in ['meson', 'cmake@']:
regex = re.compile(r'(?:\\\\)+(?=\\?@)|\\@|@([-a-zA-Z0-9_]+)@')
- elif format == 'cmake':
+ elif variable_format == 'cmake':
regex = re.compile(r'(?:\\\\)+(?=\\?\$)|\\\${|\${([-a-zA-Z0-9_]+)}')
else:
- raise MesonException('Format "{}" not handled'.format(format))
+ raise MesonException('Format "{}" not handled'.format(variable_format))
search_token = '#mesondefine'
- if format != 'meson':
+ if variable_format != 'meson':
search_token = '#cmakedefine'
result = []
@@ -808,7 +808,7 @@ def do_conf_file(src, dst, confdata, format, encoding='utf-8'):
confdata_useless = False
line = do_mesondefine(line, confdata)
else:
- line, missing = do_replacement(regex, line, format, confdata)
+ line, missing = do_replacement(regex, line, variable_format, confdata)
missing_variables.update(missing)
if missing:
confdata_useless = False