mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-12 10:16:17 +03:00
Fixed some Windows issues.
This commit is contained in:
parent
cb1f990a92
commit
5cb73c94e9
|
@ -88,7 +88,7 @@ struct ImagingIncrementalCodecStruct {
|
|||
static void flush_stream(ImagingIncrementalCodec codec);
|
||||
|
||||
#if _WIN32
|
||||
static void __stdcall
|
||||
static unsigned int __stdcall
|
||||
codec_thread(void *ptr)
|
||||
{
|
||||
ImagingIncrementalCodec codec = (ImagingIncrementalCodec)ptr;
|
||||
|
@ -98,6 +98,8 @@ codec_thread(void *ptr)
|
|||
flush_stream(codec);
|
||||
|
||||
SetEvent(codec->hCodecEvent);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
static void *
|
||||
|
@ -327,7 +329,7 @@ ImagingIncrementalCodecPushBuffer(ImagingIncrementalCodec codec,
|
|||
|
||||
/* Wait for the thread to ask for data */
|
||||
#ifdef _WIN32
|
||||
WaitForSingleObject(codec->hCodecEvent);
|
||||
WaitForSingleObject(codec->hCodecEvent, INFINITE);
|
||||
#else
|
||||
pthread_mutex_lock(&codec->codec_mutex);
|
||||
pthread_cond_wait(&codec->codec_cond, &codec->codec_mutex);
|
||||
|
@ -375,7 +377,7 @@ ImagingIncrementalCodecPushBuffer(ImagingIncrementalCodec codec,
|
|||
|
||||
#ifdef _WIN32
|
||||
SetEvent(codec->hDataEvent);
|
||||
WaitForSingleObject(codec->hCodecEvent);
|
||||
WaitForSingleObject(codec->hCodecEvent, INFINITE);
|
||||
#else
|
||||
pthread_cond_signal(&codec->data_cond);
|
||||
pthread_mutex_unlock(&codec->data_mutex);
|
||||
|
@ -433,7 +435,7 @@ ImagingIncrementalCodecRead(ImagingIncrementalCodec codec,
|
|||
codec->result = (int)(codec->stream.ptr - codec->stream.buffer);
|
||||
#if _WIN32
|
||||
SetEvent(codec->hCodecEvent);
|
||||
WaitForSingleObject(codec->hDataEvent);
|
||||
WaitForSingleObject(codec->hDataEvent, INFINITE);
|
||||
#else
|
||||
pthread_cond_signal(&codec->codec_cond);
|
||||
pthread_mutex_unlock(&codec->codec_mutex);
|
||||
|
@ -509,7 +511,7 @@ ImagingIncrementalCodecSkip(ImagingIncrementalCodec codec,
|
|||
codec->result = (int)(codec->stream.ptr - codec->stream.buffer);
|
||||
#if _WIN32
|
||||
SetEvent(codec->hCodecEvent);
|
||||
WaitForSingleObject(codec->hDataEvent);
|
||||
WaitForSingleObject(codec->hDataEvent, INFINITE);
|
||||
#else
|
||||
pthread_cond_signal(&codec->codec_cond);
|
||||
pthread_mutex_unlock(&codec->codec_mutex);
|
||||
|
@ -590,7 +592,7 @@ ImagingIncrementalCodecWrite(ImagingIncrementalCodec codec,
|
|||
codec->result = (int)(codec->stream.ptr - codec->stream.buffer);
|
||||
#if _WIN32
|
||||
SetEvent(codec->hCodecEvent);
|
||||
WaitForSingleObject(codec->hDataEvent);
|
||||
WaitForSingleObject(codec->hDataEvent, INFINITE);
|
||||
#else
|
||||
pthread_cond_signal(&codec->codec_cond);
|
||||
pthread_mutex_unlock(&codec->codec_mutex);
|
||||
|
|
13
setup.py
13
setup.py
|
@ -89,6 +89,7 @@ NAME = 'Pillow'
|
|||
VERSION = '2.3.0'
|
||||
TCL_ROOT = None
|
||||
JPEG_ROOT = None
|
||||
JPEG2K_ROOT = None
|
||||
ZLIB_ROOT = None
|
||||
TIFF_ROOT = None
|
||||
FREETYPE_ROOT = None
|
||||
|
@ -152,7 +153,7 @@ class pil_build_ext(build_ext):
|
|||
#
|
||||
# add configured kits
|
||||
|
||||
for root in (TCL_ROOT, JPEG_ROOT, TIFF_ROOT, ZLIB_ROOT,
|
||||
for root in (TCL_ROOT, JPEG_ROOT, JPEG2K_ROOT, TIFF_ROOT, ZLIB_ROOT,
|
||||
FREETYPE_ROOT, LCMS_ROOT):
|
||||
if isinstance(root, type(())):
|
||||
lib_root, include_root = root
|
||||
|
@ -323,6 +324,16 @@ class pil_build_ext(build_ext):
|
|||
_add_directory(library_dirs, "/usr/lib")
|
||||
_add_directory(include_dirs, "/usr/include")
|
||||
|
||||
# on Windows, look for the OpenJPEG libraries in the location that
|
||||
# the official installed puts them
|
||||
if sys.platform == "win32":
|
||||
_add_directory(library_dirs,
|
||||
os.path.join(os.environ.get("ProgramFiles", ""),
|
||||
"OpenJPEG 2.0", "lib"))
|
||||
_add_directory(include_dirs,
|
||||
os.path.join(os.environ.get("ProgramFiles", ""),
|
||||
"OpenJPEG 2.0", "include"))
|
||||
|
||||
#
|
||||
# insert new dirs *before* default libs, to avoid conflicts
|
||||
# between Python PYD stub libs and real libraries
|
||||
|
|
Loading…
Reference in New Issue
Block a user