From c2890d1f10ff3745449ab6d34fe7ee6ac68515fb Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Mon, 12 Oct 2020 18:38:36 +1100 Subject: [PATCH] Moved warning to end of execution --- setup.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/setup.py b/setup.py index 2f7c85e9b..e02095bd2 100755 --- a/setup.py +++ b/setup.py @@ -38,12 +38,16 @@ ZLIB_ROOT = None if sys.platform == "win32" and sys.version_info >= (3, 10): - warnings.warn( - f"Pillow {PILLOW_VERSION} does not support Python " - f"{sys.version_info.major}.{sys.version_info.minor} and does not provide " - "prebuilt Windows binaries. We do not recommend building from source on " - "Windows.", - RuntimeWarning, + import atexit + + atexit.register( + lambda: warnings.warn( + f"Pillow {PILLOW_VERSION} does not support Python " + f"{sys.version_info.major}.{sys.version_info.minor} and does not provide " + "prebuilt Windows binaries. We do not recommend building from source on " + "Windows.", + RuntimeWarning, + ) )