python/meson: split the f.write() call and use f-strings
This commit is contained in:
parent
bd9e449b69
commit
b8eb9b466a
@ -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=()):
|
||||
|
Loading…
Reference in New Issue
Block a user