From 8999ccb570e97ee7bbf5c3fdfab042119eebc42a Mon Sep 17 00:00:00 2001 From: wiredfool Date: Wed, 19 Apr 2017 07:39:39 -0700 Subject: [PATCH] single version for build --- PIL/__init__.py | 6 ++++-- PIL/version.py | 2 ++ _imaging.c | 2 -- setup.py | 10 +++++++++- 4 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 PIL/version.py diff --git a/PIL/__init__.py b/PIL/__init__.py index b8a071db1..f418e9e03 100644 --- a/PIL/__init__.py +++ b/PIL/__init__.py @@ -11,8 +11,10 @@ # ;-) -VERSION = '1.1.7' # PIL version -PILLOW_VERSION = '4.2.0.dev0' # Pillow +from . import version + + +PILLOW_VERSION = version.__version__ __version__ = PILLOW_VERSION diff --git a/PIL/version.py b/PIL/version.py new file mode 100644 index 000000000..9c3d2f1a3 --- /dev/null +++ b/PIL/version.py @@ -0,0 +1,2 @@ +# Master version for Pillow +__version__ = '4.1.0' diff --git a/_imaging.c b/_imaging.c index 7c66a63bc..9ff706ced 100644 --- a/_imaging.c +++ b/_imaging.c @@ -71,8 +71,6 @@ * See the README file for information on usage and redistribution. */ -#define PILLOW_VERSION "4.2.0.dev0" - #include "Python.h" #ifdef HAVE_LIBZ diff --git a/setup.py b/setup.py index 51106692d..c2248c3b3 100755 --- a/setup.py +++ b/setup.py @@ -95,6 +95,12 @@ def _read(file): return fp.read() +def get_version(): + version_file = 'PIL/version.py' + with open(version_file, 'ra') as f: + exec(compile(f.read(), version_file, 'exec')) + return locals()['__version__'] + try: import _tkinter except (ImportError, OSError): @@ -102,7 +108,7 @@ except (ImportError, OSError): _tkinter = None NAME = 'Pillow' -PILLOW_VERSION = '4.2.0.dev0' +PILLOW_VERSION = get_version() JPEG_ROOT = None JPEG2K_ROOT = None ZLIB_ROOT = None @@ -578,6 +584,8 @@ class pil_build_ext(build_ext): if struct.unpack("h", "\0\1".encode('ascii'))[0] == 1: defs.append(("WORDS_BIGENDIAN", None)) + defs.append(("PILLOW_VERSION", '"%s"'%PILLOW_VERSION)) + exts = [(Extension("PIL._imaging", files, libraries=libs,