Skip to content

Commit c8391aa

Browse files
committed
Use the Windows functions to get TCL functions on Cygwin.
This is related to linking semantics, so Cygwin should follow the Windows codepath.
1 parent f671ec8 commit c8391aa

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,7 @@ def build_extensions(self):
887887
else:
888888
self._remove_extension("PIL._webp")
889889

890-
tk_libs = ["psapi"] if sys.platform == "win32" else []
890+
tk_libs = ["psapi"] if (sys.platform == "win32" or sys.platform == "cygwin") else []
891891
self._update_extension("PIL._imagingtk", tk_libs)
892892

893893
build_ext.build_extensions(self)

src/Tk/tkImaging.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ TkImaging_Init(Tcl_Interp *interp) {
219219

220220
#define TKINTER_FINDER "PIL._tkinter_finder"
221221

222-
#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
222+
#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__CYGWIN__)
223223

224224
/*
225225
* On Windows, we can't load the tkinter module to get the Tcl or Tk symbols,

src/libImaging/ImPlatform.h

+8-1
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,18 @@
3131
#endif
3232
#endif
3333

34-
#ifdef _WIN32
34+
#if defined(_WIN32) || defined(__CYGWIN__)
3535

3636
#define WIN32_LEAN_AND_MEAN
3737
#include <Windows.h>
3838

39+
#ifdef __CYGWIN__
40+
#undef _WIN64
41+
#undef _WIN32
42+
#undef __WIN32__
43+
#undef WIN32
44+
#endif
45+
3946
#else
4047
/* For System that are not Windows, we'll need to define these. */
4148

0 commit comments

Comments
 (0)