diff --git a/setup.py b/setup.py index d54e30dfa..d2f376d44 100755 --- a/setup.py +++ b/setup.py @@ -24,11 +24,31 @@ from setuptools import Extension, setup # comment this out to disable multi threaded builds. import mp_compile + +def get_version(): + version_file = "src/PIL/_version.py" + with open(version_file, "r") as f: + exec(compile(f.read(), version_file, "exec")) + return locals()["__version__"] + + +NAME = "Pillow" +PILLOW_VERSION = get_version() +FREETYPE_ROOT = None +IMAGEQUANT_ROOT = None +JPEG2K_ROOT = None +JPEG_ROOT = None +LCMS_ROOT = None +TIFF_ROOT = None +ZLIB_ROOT = None + + if sys.platform == "win32" and sys.version_info >= (3, 9): warnings.warn( - "Pillow does not yet support Python {}.{} and does not yet provide " - "prebuilt Windows binaries. We do not recommend building from " - "source on Windows.".format(sys.version_info.major, sys.version_info.minor), + "Pillow {} does not yet support Python {}.{} and does not yet provide prebuilt" + "Windows binaries. We do not recommend building from source on Windows.".format( + PILLOW_VERSION, sys.version_info.major, sys.version_info.minor + ), RuntimeWarning, ) @@ -233,24 +253,6 @@ def _read(file): return fp.read() -def get_version(): - version_file = "src/PIL/_version.py" - with open(version_file, "r") as f: - exec(compile(f.read(), version_file, "exec")) - return locals()["__version__"] - - -NAME = "Pillow" -PILLOW_VERSION = get_version() -JPEG_ROOT = None -JPEG2K_ROOT = None -ZLIB_ROOT = None -IMAGEQUANT_ROOT = None -TIFF_ROOT = None -FREETYPE_ROOT = None -LCMS_ROOT = None - - def _pkg_config(name): try: command = os.environ.get("PKG_CONFIG", "pkg-config")