]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
feat(tools): warn about the Python version used in async-to-sync
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Fri, 13 Oct 2023 14:04:12 +0000 (16:04 +0200)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Fri, 13 Oct 2023 15:51:31 +0000 (17:51 +0200)
Notify the user that they may get spurious results.

tools/async_to_sync.py

index c3ccb27469ae952a83327eab5d8d9dd5813602bb..71d37a150bcb051992c20ad2698e18e3dd8dbaf9 100755 (executable)
@@ -72,6 +72,17 @@ def main() -> int:
     if opt.docker:
         return run_in_docker()
 
+    current_ver = ".".join(map(str, sys.version_info[:2]))
+    if current_ver != PYVER:
+        logger.warning(
+            "Expecting output generated by Python %s; you are running %s instead.",
+            PYVER,
+            current_ver,
+        )
+        logger.warning(
+            " You might get spurious changes that will be rejected by the CI linter."
+        )
+
     outputs = []
     for fpin in opt.inputs:
         fpout = fpin.parent / fpin.name.replace("_async", "")