diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2016-11-11 11:13:39 +0530 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2016-11-12 11:51:37 -0500 |
commit | 3a84136268392a09be671af3fc228761a4d25cff (patch) | |
tree | 4252f3b3a9a983b77dd3759ea039b64bc30075bf /mesonbuild/backend/backends.py | |
parent | 1e0ae0a083cc454dad64f9195e7b5e08b80f9bd9 (diff) | |
download | meson-3a84136268392a09be671af3fc228761a4d25cff.zip meson-3a84136268392a09be671af3fc228761a4d25cff.tar.gz meson-3a84136268392a09be671af3fc228761a4d25cff.tar.bz2 |
Fix regex used in custom target evaluation
Instead of using a whitelist, use a blacklist. Also print a more useful
error if the regex fails to match.
Use an underscore in the gir test to trigger this.
Fixes #436
Diffstat (limited to 'mesonbuild/backend/backends.py')
-rw-r--r-- | mesonbuild/backend/backends.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index d799616..45d946f 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -601,11 +601,17 @@ class Backend(): i = i.replace('@OUTDIR@', outdir) elif '@DEPFILE@' in i: if target.depfile is None: - raise MesonException('Custom target %s has @DEPFILE@ but no depfile keyword argument.' % target.name) + msg = 'Custom target {!r} has @DEPFILE@ but no depfile ' \ + 'keyword argument.'.format(target.name) + raise MesonException(msg) dfilename = os.path.join(outdir, target.depfile) i = i.replace('@DEPFILE@', dfilename) elif '@PRIVATE_OUTDIR_' in i: - match = re.search('@PRIVATE_OUTDIR_(ABS_)?([-a-zA-Z0-9.@:]*)@', i) + match = re.search('@PRIVATE_OUTDIR_(ABS_)?([^\/\s*]*)@', i) + if not match: + msg = 'Custom target {!r} has an invalid argument {!r}' \ + ''.format(target.name, i) + raise MesonException(msg) source = match.group(0) if match.group(1) is None and not absolute_paths: lead_dir = '' |