meson
meson copied to clipboard
string.format() with identity-expressions
With fstrings we can format identity expressions:
a = 1
string = f'@a@'
Positional arguments with string.format()
a = 1
'@0@'.format('a')
In our use case, we want to format strings with identity expressions. We use a native file with meson.get_external_property().
The name
property may contain @a@
.
string = meson.get_external_property('name', 'default')
string.format() # this should replace identity expressions, i.e. @a@ -> 1
~~That's get_variable(string)
, is it not?~~ Edit: actually, I misread, but:
Positional arguments with string.format()
a = 1 '@0@'.format('a')
doesn't produce 1
, but a
, so I'm not sure about the logic that ends with string.format()
.