mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-01 23:03:54 -06:00
meson: fix Windows build
The build fails on Windows. Replace calls to Unix programs like ´cat´, ´sed´ and ´true´ with calls to ´python´ and wrap calls to ´os.path.relpath´ in try-except because it can fail when the two paths are on different drives. Make sure to convert the Windows paths to Unix paths to prevent warnings in generated files. Signed-off-by: oltolm <oleg.tolmatcev@gmail.com> Message-id: 20250612221521.1109-2-oleg.tolmatcev@gmail.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
a6f0227759
commit
9761ad5f65
10 changed files with 23 additions and 19 deletions
|
@ -12,12 +12,14 @@ __maintainer__ = "Stefan Hajnoczi"
|
|||
__email__ = "stefanha@redhat.com"
|
||||
|
||||
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import weakref
|
||||
from pathlib import PurePath
|
||||
|
||||
import tracetool.format
|
||||
import tracetool.backend
|
||||
import tracetool.format
|
||||
|
||||
|
||||
def error_write(*lines):
|
||||
|
@ -36,7 +38,7 @@ out_fobj = sys.stdout
|
|||
|
||||
def out_open(filename):
|
||||
global out_filename, out_fobj
|
||||
out_filename = filename
|
||||
out_filename = posix_relpath(filename)
|
||||
out_fobj = open(filename, 'wt')
|
||||
|
||||
def out(*lines, **kwargs):
|
||||
|
@ -308,7 +310,7 @@ class Event(object):
|
|||
fmt = [fmt_trans, fmt]
|
||||
args = Arguments.build(groups["args"])
|
||||
|
||||
return Event(name, props, fmt, args, lineno, filename)
|
||||
return Event(name, props, fmt, args, lineno, posix_relpath(filename))
|
||||
|
||||
def __repr__(self):
|
||||
"""Evaluable string representation for this object."""
|
||||
|
@ -447,3 +449,10 @@ def generate(events, group, format, backends,
|
|||
tracetool.backend.dtrace.PROBEPREFIX = probe_prefix
|
||||
|
||||
tracetool.format.generate(events, format, backend, group)
|
||||
|
||||
def posix_relpath(path, start=None):
|
||||
try:
|
||||
path = os.path.relpath(path, start)
|
||||
except ValueError:
|
||||
pass
|
||||
return PurePath(path).as_posix()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue