diff options
author | Marco Nilsson <marco@zyax.se> | 2024-01-11 17:30:57 +0300 |
---|---|---|
committer | Petteri Aimonen <jpa@github.mail.kapsi.fi> | 2024-01-11 18:07:07 +0300 |
commit | 75445fd5fbf9ac72f46905b128f5d94cb7c04093 (patch) | |
tree | b74b338d8fab6bac3503f7f3fd09da8f0b898123 | |
parent | bfe9b68848110070ebadf88215740a6417dff6c8 (diff) |
Fix for Python 2.x.
F-strings aren't available in Python 2.
-rwxr-xr-x | generator/nanopb_generator.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/generator/nanopb_generator.py b/generator/nanopb_generator.py index 9f5cb63..55601de 100755 --- a/generator/nanopb_generator.py +++ b/generator/nanopb_generator.py @@ -1523,8 +1523,9 @@ class Message(ProtoElement): result += 'struct MessageDescriptor<%s> {\n' % (self.name) result += ' static PB_INLINE_CONSTEXPR const pb_size_t fields_array_length = %d;\n' % (self.count_all_fields()) - if f"{self.name}_size" in local_defines: - result += ' static PB_INLINE_CONSTEXPR const pb_size_t max_size = %s_size;\n' % (self.name) + size_define = "%s_size" % (self.name) + if size_define in local_defines: + result += ' static PB_INLINE_CONSTEXPR const pb_size_t max_size = %s;\n' % (size_define) result += ' static inline const pb_msgdesc_t* fields() {\n' result += ' return &%s_msg;\n' % (self.name) |