diff options
author | Ozan Tezcan <ozantezcan@gmail.com> | 2023-03-15 14:55:15 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-15 13:55:15 +0200 |
commit | 72f5aad014c5138f4521921de116f50a8af1790c (patch) | |
tree | 2e214d38a3a4412de23ac8a5f8e94f9fef3ffc3c /utils | |
parent | 70b2c4f5fd4dc5ca592aad2128d0fd43e1e8f82c (diff) | |
download | redis-72f5aad014c5138f4521921de116f50a8af1790c.tar.gz |
Use older string format to support earlier python versions (#11920)
Redis build runs `utils/generate-command-code.py` if there is a change in `src/commands/*.json` files.
In https://github.com/redis/redis/pull/10273, we used f-string format in this script. f-string feature was introduced in python3.6.
If a system has an earlier python version, build might fail.
Added some changes to make that script compatible with earlier python versions.
Diffstat (limited to 'utils')
-rwxr-xr-x | utils/generate-command-code.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/utils/generate-command-code.py b/utils/generate-command-code.py index b5847c469..ce1128e06 100755 --- a/utils/generate-command-code.py +++ b/utils/generate-command-code.py @@ -252,11 +252,11 @@ class ReplySchema(object): self.schema = {} if desc.get("type") == "object": if desc.get("properties") and desc.get("additionalProperties") is None: - print(f"{self.name}: Any object that has properties should have the additionalProperties field") + print("%s: Any object that has properties should have the additionalProperties field" % {self.name}) exit(1) elif desc.get("type") == "array": if desc.get("items") and isinstance(desc["items"], list) and any([desc.get(k) is None for k in ["minItems", "maxItems"]]): - print(f"{self.name}: Any array that has items should have the minItems and maxItems fields") + print("%s: Any array that has items should have the minItems and maxItems fields" % {self.name}) exit(1) for k, v in desc.items(): if isinstance(v, dict): @@ -543,8 +543,8 @@ if check_command_error_counter != 0: exit(1) commands_filename = "commands_with_reply_schema" if args.with_reply_schema else "commands" -print(f"Generating {commands_filename}.c...") -with open(f"{srcdir}/{commands_filename}.c", "w") as f: +print("Generating %s.c..." % {commands_filename}) +with open("%s/%s.c" % (srcdir, commands_filename), "w") as f: f.write("/* Automatically generated by %s, do not edit. */\n\n" % os.path.basename(__file__)) f.write("#include \"server.h\"\n") f.write( |