mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-11-04 09:57:43 +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
 | 
					    from . import _imaging as core
 | 
				
			||||||
    if PILLOW_VERSION != getattr(core, 'PILLOW_VERSION', None):
 | 
					    if PILLOW_VERSION != getattr(core, 'PILLOW_VERSION', None):
 | 
				
			||||||
        raise ImportError("The _imaging extension was built for another "
 | 
					        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:
 | 
					except ImportError as v:
 | 
				
			||||||
    core = _imaging_not_installed()
 | 
					    core = _imaging_not_installed()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3435,6 +3435,7 @@ static PyMethodDef functions[] = {
 | 
				
			||||||
static int
 | 
					static int
 | 
				
			||||||
setup_module(PyObject* m) {
 | 
					setup_module(PyObject* m) {
 | 
				
			||||||
    PyObject* d = PyModule_GetDict(m);
 | 
					    PyObject* d = PyModule_GetDict(m);
 | 
				
			||||||
 | 
					    const char* version = (char*)PILLOW_VERSION;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* Ready object types */
 | 
					    /* Ready object types */
 | 
				
			||||||
    if (PyType_Ready(&Imaging_Type) < 0)
 | 
					    if (PyType_Ready(&Imaging_Type) < 0)
 | 
				
			||||||
| 
						 | 
					@ -3479,7 +3480,7 @@ setup_module(PyObject* m) {
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    PyDict_SetItemString(d, "PILLOW_VERSION", PyUnicode_FromString(PILLOW_VERSION));
 | 
					    PyDict_SetItemString(d, "PILLOW_VERSION", PyUnicode_FromString(version));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return 0;
 | 
					    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:
 | 
					        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))
 | 
					        if sys.platform == "win32":
 | 
				
			||||||
 | 
					            defs.append(("PILLOW_VERSION", '"\\"%s\\""'%PILLOW_VERSION))
 | 
				
			||||||
 | 
					        else:
 | 
				
			||||||
 | 
					            defs.append(("PILLOW_VERSION", '"%s"'%PILLOW_VERSION))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        exts = [(Extension("PIL._imaging",
 | 
					        exts = [(Extension("PIL._imaging",
 | 
				
			||||||
                           files,
 | 
					                           files,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user