diff options
author | Luke Elliott <luke.b.elliott@gmail.com> | 2021-01-10 11:57:59 +0000 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2021-01-12 17:42:57 +0000 |
commit | 9efcdba0d59a95d9c5ddd9c32f7870ac2183c5ea (patch) | |
tree | c3b39ce46052047687b729e6f569af2d5f47bc56 /mesonbuild/rewriter.py | |
parent | 5ff1a3ab25504563f87ac064ce21826cb0b936aa (diff) | |
download | meson-9efcdba0d59a95d9c5ddd9c32f7870ac2183c5ea.zip meson-9efcdba0d59a95d9c5ddd9c32f7870ac2183c5ea.tar.gz meson-9efcdba0d59a95d9c5ddd9c32f7870ac2183c5ea.tar.bz2 |
Allow '//' as project function id due to git bash path conversion.
See https://stackoverflow.com/questions/54258996/git-bash-string-parameter-with-at-start-is-being-expanded-to-a-file-path
Diffstat (limited to 'mesonbuild/rewriter.py')
-rw-r--r-- | mesonbuild/rewriter.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/mesonbuild/rewriter.py b/mesonbuild/rewriter.py index 6b7a987..9cd9ad0 100644 --- a/mesonbuild/rewriter.py +++ b/mesonbuild/rewriter.py @@ -500,8 +500,12 @@ class Rewriter: node = None arg_node = None if cmd['function'] == 'project': - if cmd['id'] != '/': - mlog.error('The ID for the function type project must be "/"', *self.on_error()) + # msys bash may expand '/' to a path. It will mangle '//' to '/' + # but in order to keep usage shell-agnostic, also allow `//` as + # the function ID such that it will work in both msys bash and + # other shells. + if {'/', '//'}.isdisjoint({cmd['id']}): + mlog.error('The ID for the function type project must be "/" or "//" not "' + cmd['id'] + '"', *self.on_error()) return self.handle_error() node = self.interpreter.project_node arg_node = node.args |