summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2021-08-10 14:34:17 +0200
committerMax Kellermann <max@musicpd.org>2021-08-10 15:00:58 +0200
commitb8eb9b466a50118787def88a70cc2b1119a885b9 (patch)
treec9a7bade8b84d8a11d52d9c200e26ad58dec0cf4
parentbd9e449b69e09f309f26d97ede0e363458e163c0 (diff)
python/meson: split the f.write() call and use f-strings
-rw-r--r--python/build/meson.py46
1 files changed, 21 insertions, 25 deletions
diff --git a/python/build/meson.py b/python/build/meson.py
index 377969b28..049b52251 100644
--- a/python/build/meson.py
+++ b/python/build/meson.py
@@ -34,41 +34,37 @@ def make_cross_file(toolchain):
path = os.path.join(toolchain.build_path, 'meson.cross')
os.makedirs(toolchain.build_path, exist_ok=True)
with open(path, 'w') as f:
- f.write("""
+ f.write(f"""
[binaries]
-c = '%s'
-cpp = '%s'
-ar = '%s'
-strip = '%s'
-pkgconfig = '%s'
-%s
+c = '{toolchain.cc}'
+cpp = '{toolchain.cxx}'
+ar = '{toolchain.ar}'
+strip = '{toolchain.strip}'
+pkgconfig = '{toolchain.pkg_config}'
+""")
+ if toolchain.is_windows:
+ f.write(f"windres = '{toolchain.windres}'\n")
+
+ f.write(f"""
[properties]
-root = '%s'
+root = '{toolchain.install_prefix}'
-c_args = %s
-c_link_args = %s
+c_args = {repr((toolchain.cppflags + ' ' + toolchain.cflags).split())}
+c_link_args = {repr(toolchain.ldflags.split() + toolchain.libs.split())}
-cpp_args = %s
-cpp_link_args = %s
+cpp_args = {repr((toolchain.cppflags + ' ' + toolchain.cxxflags).split())}
+cpp_link_args = {repr(toolchain.ldflags.split() + toolchain.libs.split())}
# Keep Meson from executing Android-x86 test binariees
needs_exe_wrapper = true
[host_machine]
-system = '%s'
-cpu_family = '%s'
-cpu = '%s'
-endian = '%s'
- """ % (toolchain.cc, toolchain.cxx, toolchain.ar, toolchain.strip,
- toolchain.pkg_config,
- windres,
- toolchain.install_prefix,
- repr((toolchain.cppflags + ' ' + toolchain.cflags).split()),
- repr(toolchain.ldflags.split() + toolchain.libs.split()),
- repr((toolchain.cppflags + ' ' + toolchain.cxxflags).split()),
- repr(toolchain.ldflags.split() + toolchain.libs.split()),
- system, cpu_family, cpu, endian))
+system = '{system}'
+cpu_family = '{cpu_family}'
+cpu = '{cpu}'
+endian = '{endian}'
+""")
return path
def configure(toolchain, src, build, args=()):