mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-10 19:56:47 +03:00
Fix to ensure that define is interpreted as a string on windows
This commit is contained in:
parent
67d6e00751
commit
edc8d8627c
|
@ -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()
|
||||
|
|
|
@ -3435,6 +3435,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)
|
||||
|
@ -3479,7 +3480,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;
|
||||
}
|
||||
|
|
5
setup.py
5
setup.py
|
@ -584,7 +584,10 @@ 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))
|
||||
if sys.platform == "win32":
|
||||
defs.append(("PILLOW_VERSION", '"\\"%s\\""'%PILLOW_VERSION))
|
||||
else:
|
||||
defs.append(("PILLOW_VERSION", '"%s"'%PILLOW_VERSION))
|
||||
|
||||
exts = [(Extension("PIL._imaging",
|
||||
files,
|
||||
|
|
Loading…
Reference in New Issue
Block a user