Skip to content

Commit

Permalink
Imaging.h: confusion with system
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ax3l committed Sep 16, 2020
1 parent e50d48f commit c36290c
Show file tree
Hide file tree
Showing 13 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/_imaging.c
Expand Up @@ -88,7 +88,7 @@
#endif
#endif

#include "Imaging.h"
#include "libImaging/Imaging.h"

#define _USE_MATH_DEFINES
#include <math.h>
Expand Down
2 changes: 1 addition & 1 deletion src/_imagingcms.c
Expand Up @@ -31,7 +31,7 @@ kevin@cazabon.com\n\
#include "datetime.h"

#include "lcms2.h"
#include "Imaging.h"
#include "libImaging/Imaging.h"

#define PYCMSVERSION "1.0.0 pil"

Expand Down
2 changes: 1 addition & 1 deletion src/_imagingft.c
Expand Up @@ -20,7 +20,7 @@

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#include "Imaging.h"
#include "libImaging/Imaging.h"

#include <ft2build.h>
#include FT_FREETYPE_H
Expand Down
2 changes: 1 addition & 1 deletion src/_imagingmath.c
Expand Up @@ -15,7 +15,7 @@

#include "Python.h"

#include "Imaging.h"
#include "libImaging/Imaging.h"

#include "math.h"
#include "float.h"
Expand Down
2 changes: 1 addition & 1 deletion src/_imagingmorph.c
Expand Up @@ -12,7 +12,7 @@
*/

#include "Python.h"
#include "Imaging.h"
#include "libImaging/Imaging.h"

#define LUT_SIZE (1<<9)

Expand Down
2 changes: 1 addition & 1 deletion src/_imagingtk.c
Expand Up @@ -14,7 +14,7 @@


#include "Python.h"
#include "Imaging.h"
#include "libImaging/Imaging.h"

#include "_tkmini.h"

Expand Down
2 changes: 1 addition & 1 deletion src/_webp.c
@@ -1,6 +1,6 @@
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include "Imaging.h"
#include "libImaging/Imaging.h"
#include <webp/encode.h>
#include <webp/decode.h>
#include <webp/types.h>
Expand Down
2 changes: 1 addition & 1 deletion src/decode.c
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/display.c
Expand Up @@ -25,7 +25,7 @@

#include "Python.h"

#include "Imaging.h"
#include "libImaging/Imaging.h"

/* -------------------------------------------------------------------- */
/* Windows DIB support */
Expand Down
2 changes: 1 addition & 1 deletion src/encode.c
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/map.c
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/outline.c
Expand Up @@ -19,7 +19,7 @@

#include "Python.h"

#include "Imaging.h"
#include "libImaging/Imaging.h"


/* -------------------------------------------------------------------- */
Expand Down
2 changes: 1 addition & 1 deletion src/path.c
Expand Up @@ -27,7 +27,7 @@


#include "Python.h"
#include "Imaging.h"
#include "libImaging/Imaging.h"

#include <math.h>

Expand Down

0 comments on commit c36290c

Please sign in to comment.