From f79379ed7c24fabdb91a6680e39f1e9e1d045d51 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Tue, 15 Sep 2020 22:10:28 -0700 Subject: [PATCH] Imaging.h: confusion with system The file `libImaging/Imaging.h` gets installed flat on Ubuntus into the public Python includes. When building a newer version of Pillow from source and hinting the Python includes "too early" in includes, e.g. in package managers, this can confuse the two files and pick up the external file over the internal one. With different versions, this mismatch can lead to build errors, e.g. undefined macros. The most robust way to avoid this is to pre-fix the internal include accordingly, so that the relative path to the including file has to match as well. --- src/_imaging.c | 2 +- src/_imagingcms.c | 2 +- src/_imagingft.c | 2 +- src/_imagingmath.c | 2 +- src/_imagingmorph.c | 2 +- src/_imagingtk.c | 2 +- src/_webp.c | 2 +- src/decode.c | 2 +- src/display.c | 2 +- src/encode.c | 2 +- src/map.c | 2 +- src/outline.c | 2 +- src/path.c | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/_imaging.c b/src/_imaging.c index d3159a494..b490763a2 100644 --- a/src/_imaging.c +++ b/src/_imaging.c @@ -88,7 +88,7 @@ #endif #endif -#include "Imaging.h" +#include "libImaging/Imaging.h" #define _USE_MATH_DEFINES #include diff --git a/src/_imagingcms.c b/src/_imagingcms.c index cba41ec90..6114b6018 100644 --- a/src/_imagingcms.c +++ b/src/_imagingcms.c @@ -31,7 +31,7 @@ http://www.cazabon.com\n\ #include "datetime.h" #include "lcms2.h" -#include "Imaging.h" +#include "libImaging/Imaging.h" #define PYCMSVERSION "1.0.0 pil" diff --git a/src/_imagingft.c b/src/_imagingft.c index e00be58f7..e64e959c6 100644 --- a/src/_imagingft.c +++ b/src/_imagingft.c @@ -20,7 +20,7 @@ #define PY_SSIZE_T_CLEAN #include "Python.h" -#include "Imaging.h" +#include "libImaging/Imaging.h" #include #include FT_FREETYPE_H diff --git a/src/_imagingmath.c b/src/_imagingmath.c index 959859a1d..b99356d14 100644 --- a/src/_imagingmath.c +++ b/src/_imagingmath.c @@ -15,7 +15,7 @@ #include "Python.h" -#include "Imaging.h" +#include "libImaging/Imaging.h" #include "math.h" #include "float.h" diff --git a/src/_imagingmorph.c b/src/_imagingmorph.c index 4f7844604..0fe54ab77 100644 --- a/src/_imagingmorph.c +++ b/src/_imagingmorph.c @@ -12,7 +12,7 @@ */ #include "Python.h" -#include "Imaging.h" +#include "libImaging/Imaging.h" #define LUT_SIZE (1<<9) diff --git a/src/_imagingtk.c b/src/_imagingtk.c index 42dcd3533..5753f9455 100644 --- a/src/_imagingtk.c +++ b/src/_imagingtk.c @@ -14,7 +14,7 @@ #include "Python.h" -#include "Imaging.h" +#include "libImaging/Imaging.h" #include "_tkmini.h" diff --git a/src/_webp.c b/src/_webp.c index 468a9ff73..6c6ca2aa6 100644 --- a/src/_webp.c +++ b/src/_webp.c @@ -1,6 +1,6 @@ #define PY_SSIZE_T_CLEAN #include -#include "Imaging.h" +#include "libImaging/Imaging.h" #include #include #include diff --git a/src/decode.c b/src/decode.c index f60fb490e..d647e8ace 100644 --- a/src/decode.c +++ b/src/decode.c @@ -32,7 +32,7 @@ #define PY_SSIZE_T_CLEAN #include "Python.h" -#include "Imaging.h" +#include "libImaging/Imaging.h" #include "Gif.h" #include "Raw.h" diff --git a/src/display.c b/src/display.c index 6ca922e43..11686ff73 100644 --- a/src/display.c +++ b/src/display.c @@ -25,7 +25,7 @@ #include "Python.h" -#include "Imaging.h" +#include "libImaging/Imaging.h" /* -------------------------------------------------------------------- */ /* Windows DIB support */ diff --git a/src/encode.c b/src/encode.c index 62a6ec387..5f65929f1 100644 --- a/src/encode.c +++ b/src/encode.c @@ -25,7 +25,7 @@ #define PY_SSIZE_T_CLEAN #include "Python.h" -#include "Imaging.h" +#include "libImaging/Imaging.h" #include "Gif.h" #ifdef HAVE_UNISTD_H diff --git a/src/map.c b/src/map.c index ef29062cc..df2718ed7 100644 --- a/src/map.c +++ b/src/map.c @@ -20,7 +20,7 @@ #include "Python.h" -#include "Imaging.h" +#include "libImaging/Imaging.h" /* compatibility wrappers (defined in _imaging.c) */ extern int PyImaging_CheckBuffer(PyObject* buffer); diff --git a/src/outline.c b/src/outline.c index d082febaa..a109189e1 100644 --- a/src/outline.c +++ b/src/outline.c @@ -19,7 +19,7 @@ #include "Python.h" -#include "Imaging.h" +#include "libImaging/Imaging.h" /* -------------------------------------------------------------------- */ diff --git a/src/path.c b/src/path.c index 3cbdd5d44..0a6d744d5 100644 --- a/src/path.c +++ b/src/path.c @@ -27,7 +27,7 @@ #include "Python.h" -#include "Imaging.h" +#include "libImaging/Imaging.h" #include