diff --git a/Tests/test_image.py b/Tests/test_image.py index cf60f42af6e..85efd9fcdaa 100644 --- a/Tests/test_image.py +++ b/Tests/test_image.py @@ -192,6 +192,10 @@ def test_internals(self): assert not im.readonly @pytest.mark.skipif(is_win32(), reason="Test requires opening tempfile twice") + @pytest.mark.skipif( + sys.platform == "cygwin", + reason="Test requires opening an mmaped file for writing", + ) def test_readonly_save(self, tmp_path): temp_file = str(tmp_path / "temp.bmp") shutil.copy("Tests/images/rgb32bf-rgba.bmp", temp_file) diff --git a/setup.py b/setup.py index 1cd22228bfe..23d91a5f24d 100755 --- a/setup.py +++ b/setup.py @@ -898,7 +898,7 @@ def build_extensions(self): else: self._remove_extension("PIL._webp") - tk_libs = ["psapi"] if sys.platform == "win32" else [] + tk_libs = ["psapi"] if sys.platform in ("win32", "cygwin") else [] self._update_extension("PIL._imagingtk", tk_libs) build_ext.build_extensions(self) diff --git a/src/Tk/tkImaging.c b/src/Tk/tkImaging.c index 1c6c5f34a38..9ae7edff108 100644 --- a/src/Tk/tkImaging.c +++ b/src/Tk/tkImaging.c @@ -219,7 +219,7 @@ TkImaging_Init(Tcl_Interp *interp) { #define TKINTER_FINDER "PIL._tkinter_finder" -#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) +#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__CYGWIN__) /* * On Windows, we can't load the tkinter module to get the Tcl or Tk symbols, diff --git a/src/libImaging/ImPlatform.h b/src/libImaging/ImPlatform.h index 26b49d6d089..af9996ca98c 100644 --- a/src/libImaging/ImPlatform.h +++ b/src/libImaging/ImPlatform.h @@ -25,11 +25,18 @@ #endif #endif -#ifdef _WIN32 +#if defined(_WIN32) || defined(__CYGWIN__) #define WIN32_LEAN_AND_MEAN #include +#ifdef __CYGWIN__ +#undef _WIN64 +#undef _WIN32 +#undef __WIN32__ +#undef WIN32 +#endif + #else /* For System that are not Windows, we'll need to define these. */