Include Pillow version in Windows wheel warning

This commit is contained in:
Hugo 2019-11-11 16:00:17 +02:00
parent 9b927155e6
commit 01b0dbd4df

View File

@ -24,11 +24,31 @@ from setuptools import Extension, setup
# comment this out to disable multi threaded builds. # comment this out to disable multi threaded builds.
import mp_compile 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): if sys.platform == "win32" and sys.version_info >= (3, 9):
warnings.warn( warnings.warn(
"Pillow does not yet support Python {}.{} and does not yet provide " "Pillow {} does not yet support Python {}.{} and does not yet provide prebuilt"
"prebuilt Windows binaries. We do not recommend building from " "Windows binaries. We do not recommend building from source on Windows.".format(
"source on Windows.".format(sys.version_info.major, sys.version_info.minor), PILLOW_VERSION, sys.version_info.major, sys.version_info.minor
),
RuntimeWarning, RuntimeWarning,
) )
@ -233,24 +253,6 @@ def _read(file):
return fp.read() 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): def _pkg_config(name):
try: try:
command = os.environ.get("PKG_CONFIG", "pkg-config") command = os.environ.get("PKG_CONFIG", "pkg-config")