On 5/23/25 21:57, oltolm wrote:
The build failed when run on Windows. I replaced calls to Unix programs
like `cat` and `true` with calls to `python`. I wrapped calls to
`os.path.relpath` in try-except because it can fail when the two paths
are on different drives. I made sure to convert the Windows paths to
Unix paths to prevent warnings in generated files.

Thanks for the patch! The Windows build configurations that we support currently are cross-building from Linux and native build with MSYS2. MSYS2 is sufficiently POSIX-like, and also has a nice package manager.

Can you share how you set up your build environment, and especially where you get all the dependencies? Generally we'd prefer to have it covered in CI to avoid that it breaks again.

Some more comments below.

  import os.path
+from pathlib import PurePath
from tracetool import out @@ -30,6 +31,12 @@ def generate_h(event, group):
      if len(event.args) > 0:
          argnames = ", " + argnames
+ try:
+        event_filename = os.path.relpath(event.filename)
+    except ValueError:
+        event_filename = event.filename

Can this actually happen during the build?  (Same for other backends)

diff --git a/tests/functional/meson.build b/tests/functional/meson.build
index 52b4706cf..2e3bd4057 100644
--- a/tests/functional/meson.build
+++ b/tests/functional/meson.build
@@ -413,4 +413,4 @@ endforeach
run_target('precache-functional',
             depends: precache_all,
-           command: ['true'])
+           command: [python, '-c', ''])

I wonder if this can be replaced with alias_target() too; and also the pre-existing code suggests that alias_target needs at least one target, but is that really true?

So, maybe all or most uses of 'true' can just go away.

diff --git a/trace/meson.build b/trace/meson.build
index 3df454935..3a318713c 100644
--- a/trace/meson.build
+++ b/trace/meson.build
@@ -4,7 +4,7 @@ trace_events_files = []
  foreach item : [ '.' ] + trace_events_subdirs + qapi_trace_events
    if item in qapi_trace_events
      trace_events_file = item
-    group_name = item.full_path().split('/')[-1].underscorify()
+    group_name = fs.name(item).underscorify()

Even better.

  trace_events_all = custom_target('trace-events-all',
                                   output: 'trace-events-all',
                                   input: trace_events_files,
-                                 command: [ 'cat', '@INPUT@' ],
+                                 command: [ python, '-c', 'import 
fileinput;[print(line) for line in fileinput.input()]', '@INPUT@' ],

Maybe put the command in a variable name cat, like

cat = [ python, '-c',
  'import fileinput;[print(line) for line in fileinput.input()]']

Thanks,

Paolo


Reply via email to