single version for build

This commit is contained in:
wiredfool 2017-04-19 07:39:39 -07:00
parent 8b8f150d37
commit 8999ccb570
4 changed files with 15 additions and 5 deletions

View File

@ -11,8 +11,10 @@
# ;-) # ;-)
VERSION = '1.1.7' # PIL version from . import version
PILLOW_VERSION = '4.2.0.dev0' # Pillow
PILLOW_VERSION = version.__version__
__version__ = PILLOW_VERSION __version__ = PILLOW_VERSION

2
PIL/version.py Normal file
View File

@ -0,0 +1,2 @@
# Master version for Pillow
__version__ = '4.1.0'

View File

@ -71,8 +71,6 @@
* See the README file for information on usage and redistribution. * See the README file for information on usage and redistribution.
*/ */
#define PILLOW_VERSION "4.2.0.dev0"
#include "Python.h" #include "Python.h"
#ifdef HAVE_LIBZ #ifdef HAVE_LIBZ

View File

@ -95,6 +95,12 @@ def _read(file):
return fp.read() 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: try:
import _tkinter import _tkinter
except (ImportError, OSError): except (ImportError, OSError):
@ -102,7 +108,7 @@ except (ImportError, OSError):
_tkinter = None _tkinter = None
NAME = 'Pillow' NAME = 'Pillow'
PILLOW_VERSION = '4.2.0.dev0' PILLOW_VERSION = get_version()
JPEG_ROOT = None JPEG_ROOT = None
JPEG2K_ROOT = None JPEG2K_ROOT = None
ZLIB_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: if struct.unpack("h", "\0\1".encode('ascii'))[0] == 1:
defs.append(("WORDS_BIGENDIAN", None)) defs.append(("WORDS_BIGENDIAN", None))
defs.append(("PILLOW_VERSION", '"%s"'%PILLOW_VERSION))
exts = [(Extension("PIL._imaging", exts = [(Extension("PIL._imaging",
files, files,
libraries=libs, libraries=libs,