mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-28 10:00:33 +03:00
Merge pull request #2517 from wiredfool/single_version
RFC: Specify Version in one place
This commit is contained in:
commit
dc04930699
|
@ -56,7 +56,10 @@ try:
|
|||
from . import _imaging as core
|
||||
if PILLOW_VERSION != getattr(core, 'PILLOW_VERSION', None):
|
||||
raise ImportError("The _imaging extension was built for another "
|
||||
"version of Pillow or PIL")
|
||||
"version of Pillow or PIL: Core Version: %s"
|
||||
"Pillow Version: %s" %
|
||||
(getattr(core, 'PILLOW_VERSION', None),
|
||||
PILLOW_VERSION))
|
||||
|
||||
except ImportError as v:
|
||||
core = _imaging_not_installed()
|
||||
|
|
|
@ -11,8 +11,10 @@
|
|||
|
||||
# ;-)
|
||||
|
||||
VERSION = '1.1.7' # PIL version
|
||||
PILLOW_VERSION = '4.2.0.dev0' # Pillow
|
||||
from . import version
|
||||
|
||||
VERSION = '1.1.7' # PIL Version
|
||||
PILLOW_VERSION = version.__version__
|
||||
|
||||
__version__ = PILLOW_VERSION
|
||||
|
||||
|
|
2
PIL/version.py
Normal file
2
PIL/version.py
Normal file
|
@ -0,0 +1,2 @@
|
|||
# Master version for Pillow
|
||||
__version__ = '4.2.0.dev0'
|
|
@ -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
|
||||
|
@ -3417,6 +3415,7 @@ static PyMethodDef functions[] = {
|
|||
static int
|
||||
setup_module(PyObject* m) {
|
||||
PyObject* d = PyModule_GetDict(m);
|
||||
const char* version = (char*)PILLOW_VERSION;
|
||||
|
||||
/* Ready object types */
|
||||
if (PyType_Ready(&Imaging_Type) < 0)
|
||||
|
@ -3461,7 +3460,7 @@ setup_module(PyObject* m) {
|
|||
}
|
||||
#endif
|
||||
|
||||
PyDict_SetItemString(d, "PILLOW_VERSION", PyUnicode_FromString(PILLOW_VERSION));
|
||||
PyDict_SetItemString(d, "PILLOW_VERSION", PyUnicode_FromString(version));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
version: 4.2.pre.{build}
|
||||
version: '{build}'
|
||||
clone_folder: c:\pillow
|
||||
init:
|
||||
- ECHO %PYTHON%
|
||||
|
|
13
setup.py
13
setup.py
|
@ -98,6 +98,12 @@ def _read(file):
|
|||
return fp.read()
|
||||
|
||||
|
||||
def get_version():
|
||||
version_file = 'PIL/version.py'
|
||||
with open(version_file, 'r') as f:
|
||||
exec(compile(f.read(), version_file, 'exec'))
|
||||
return locals()['__version__']
|
||||
|
||||
try:
|
||||
import _tkinter
|
||||
except (ImportError, OSError):
|
||||
|
@ -105,7 +111,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
|
||||
|
@ -585,6 +591,11 @@ class pil_build_ext(build_ext):
|
|||
if struct.unpack("h", "\0\1".encode('ascii'))[0] == 1:
|
||||
defs.append(("WORDS_BIGENDIAN", None))
|
||||
|
||||
if sys.platform == "win32":
|
||||
defs.append(("PILLOW_VERSION", '"\\"%s\\""'%PILLOW_VERSION))
|
||||
else:
|
||||
defs.append(("PILLOW_VERSION", '"%s"'%PILLOW_VERSION))
|
||||
|
||||
exts = [(Extension("PIL._imaging",
|
||||
files,
|
||||
libraries=libs,
|
||||
|
|
Loading…
Reference in New Issue
Block a user