[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 14/17] meson: fix relpath failure on Win32
From: |
Paolo Bonzini |
Subject: |
[PULL 14/17] meson: fix relpath failure on Win32 |
Date: |
Thu, 27 Aug 2020 12:59:53 -0400 |
From: Yonggang Luo <luoyonggang@gmail.com>
On win32, os.path.relpath can raise an exception when computing
for example C:/msys64/mingw64/x.exe relative to E:/path/qemu-build.
Use try...except to avoid this, just using an absolute path in
this case.
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
scripts/mtest2make.py | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/scripts/mtest2make.py b/scripts/mtest2make.py
index bdb257bbd9..d7a51bf97e 100644
--- a/scripts/mtest2make.py
+++ b/scripts/mtest2make.py
@@ -53,9 +53,16 @@ i = 0
for test in json.load(sys.stdin):
env = ' '.join(('%s=%s' % (shlex.quote(k), shlex.quote(v))
for k, v in test['env'].items()))
- executable = os.path.relpath(test['cmd'][0])
+ executable = test['cmd'][0]
+ try:
+ executable = os.path.relpath(executable)
+ except:
+ pass
if test['workdir'] is not None:
- test['cmd'][0] = os.path.relpath(test['cmd'][0], test['workdir'])
+ try:
+ test['cmd'][0] = os.path.relpath(executable, test['workdir'])
+ except:
+ test['cmd'][0] = executable
else:
test['cmd'][0] = executable
cmd = '$(.test.env) %s %s' % (env, ' '.join((shlex.quote(x) for x in
test['cmd'])))
--
2.26.2
- [PULL 08/17] meson: move pixman detection to meson, (continued)
- [PULL 08/17] meson: move pixman detection to meson, Paolo Bonzini, 2020/08/27
- [PULL 10/17] configure: add --ninja option, Paolo Bonzini, 2020/08/27
- [PULL 11/17] meson: cleanup xkbcommon detection, Paolo Bonzini, 2020/08/27
- [PULL 06/17] meson: Fix chardev-baum.so name, Paolo Bonzini, 2020/08/27
- [PULL 05/17] meson: Fix meson build with --enable-libdaxctl, Paolo Bonzini, 2020/08/27
- [PULL 09/17] meson: skip SDL2 detection if --disable-system, Paolo Bonzini, 2020/08/27
- [PULL 16/17] meson: set colorout to auto, Paolo Bonzini, 2020/08/27
- [PULL 15/17] meson: Mingw64 gcc doesn't recognize system include_type for sdl2, Paolo Bonzini, 2020/08/27
- [PULL 13/17] ninjatool: quote dollars in variables, Paolo Bonzini, 2020/08/27
- [PULL 07/17] configure: default to PIE disabled on Windows platforms, Paolo Bonzini, 2020/08/27
- [PULL 14/17] meson: fix relpath failure on Win32,
Paolo Bonzini <=
- [PULL 12/17] meson: don't require CONFIG_VTE for the GTK UI, Paolo Bonzini, 2020/08/27
- [PULL 17/17] ninjatool: Fixes E$$: in generated Makefile.ninja, Paolo Bonzini, 2020/08/27
- Re: [PULL 00/17] Meson fixes for 2020-08-27, Peter Maydell, 2020/08/28