summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChun-wei Fan <fanchunwei@src.gnome.org>2023-10-20 11:24:11 +0800
committerEli Schwartz <eschwartz93@gmail.com>2023-10-26 01:12:14 -0400
commitada6236f76f4fbce4313b48eeaf9d8485516fde8 (patch)
treeca2ba0281f623567539bda6087126a6d645d00e4
parente9e098b73e116c865ae0e52bb29001740b23ba22 (diff)
downloadmeson-ada6236f76f4fbce4313b48eeaf9d8485516fde8.tar.gz
i18n module: Invoke itstool with the full command line
Certain envs may not support invoking itstool by itself directly as a script as shebang lines are not supported, such as under cmd.exe shells on Windows, that are normally used for Visual Studio (and the like, such as clang-cl) builds. This will call the corresponding interpreter to invoke itstool when needed, so that itstool can be properly run, even if shebang lines are not supported by the env. This will fix building appstream on Windows using clang-cl, for instance.
-rw-r--r--mesonbuild/modules/i18n.py6
-rw-r--r--mesonbuild/scripts/itstool.py3
2 files changed, 7 insertions, 2 deletions
diff --git a/mesonbuild/modules/i18n.py b/mesonbuild/modules/i18n.py
index c82e580a2..e375674d9 100644
--- a/mesonbuild/modules/i18n.py
+++ b/mesonbuild/modules/i18n.py
@@ -14,6 +14,7 @@
from __future__ import annotations
from os import path
+import shlex
import typing as T
from . import ExtensionModule, ModuleReturnValue, ModuleInfo
@@ -360,11 +361,14 @@ class I18nModule(ExtensionModule):
command: T.List[T.Union[str, build.BuildTarget, build.CustomTarget,
build.CustomTargetIndex, 'ExternalProgram', mesonlib.File]] = []
command.extend(state.environment.get_build_command())
+
+ itstool_cmd = self.tools['itstool'].get_command()
+ # TODO: python 3.8 can use shlex.join()
command.extend([
'--internal', 'itstool', 'join',
'-i', '@INPUT@',
'-o', '@OUTPUT@',
- '--itstool=' + self.tools['itstool'].get_path(),
+ '--itstool=' + ' '.join(shlex.quote(c) for c in itstool_cmd),
])
if its_files:
for fname in its_files:
diff --git a/mesonbuild/scripts/itstool.py b/mesonbuild/scripts/itstool.py
index 0bfcaf9b5..16af1c235 100644
--- a/mesonbuild/scripts/itstool.py
+++ b/mesonbuild/scripts/itstool.py
@@ -17,6 +17,7 @@ import os
import argparse
import subprocess
import tempfile
+import shlex
import shutil
import typing as T
@@ -56,7 +57,7 @@ def run_join(build_dir: str, itstool: str, its_files: T.List[str], mo_files: T.L
shutil.copy(mo_file, tmp_mo_fname)
locale_mo_files.append(tmp_mo_fname)
- cmd = [itstool]
+ cmd = shlex.split(itstool)
if its_files:
for fname in its_files:
cmd.extend(['-i', fname])