Fix PIL 1.1.6 installation from sources under debian


Today I found a bug in kupu integration in Plone. I prepared a patch and I tried to reinstall plonenext environment. But this time it fails to install on the PIL egg.

The PIL egg is very dependant to your architecure. It depends of libjpeg, tkinter (tcl/tk), and some other libraries. I’m working with a Debian unstable with 3 versions of tcl/tk for various programs: 8.3, 8.4 and 8.5.

The errors was the following:

getting distribution for ‘PIL’.
libImaging/Effects.c:210: warning: ‘perlin_init’ defined but not used
libImaging/Geometry.c:236: warning: ‘quadratic_transform’ defined but not used
libImaging/Quant.c:311: warning: ‘test_sorted’ defined but not used
libImaging/Quant.c:676: warning: ‘checkContained’ defined but not used
libImaging/QuantHash.c:136: warning: ‘_hashtable_test’ defined but not used
_imagingtk.c:20:16: error: tk.h: Aucun fichier ou répertoire de ce type
_imagingtk.c:23: error: expected ‘)’ before ‘*’ token
_imagingtk.c:31: error: expected specifier-qualifier-list before ‘Tcl_Interp’
_imagingtk.c: In function ‘_tkinit’:
_imagingtk.c:37: error: ‘Tcl_Interp’ undeclared (first use in this function)
_imagingtk.c:37: error: (Each undeclared identifier is reported only once
_imagingtk.c:37: error: for each function it appears in.)
_imagingtk.c:37: error: ‘interp’ undeclared (first use in this function)
_imagingtk.c:45: error: expected expression before ‘)’ token
_imagingtk.c:51: error: ‘TkappObject’ has no member named ‘interp’
_imagingtk.c:55: warning: implicit declaration of function ‘TkImaging_Init’
error: Setup script exited with error: command ‘gcc’ failed with exit status 1

All development libraries was installed, but the installer cannot find /usr/include/tk.h. There are /usr/include/tcl8.3/tk.h, /usr/include/tcl8.4/tk.h, /usr/include/tcl8.5/tk.h. Then I wrote the little patch below for the setup.py file:

Index: setup.py
===================================================================
— setup.py    (révision 460)
+++ setup.py    (copie de travail)
@@ -199,6 +199,9 @@
add_directory(library_dirs, « /usr/lib »)
add_directory(include_dirs, « /usr/include »)

+        if os.path.isfile(os.path.join(‘/usr/include’, ‘tcl’+TCL_VERSION,’tk.h’)):
+            add_directory(include_dirs, os.path.join(‘/usr/include’, ‘tcl’+TCL_VERSION))
+
#
# insert new dirs *before* default libs, to avoid conflicts
# between Python PYD stub libs and real libraries

I hope this patch is generic enough to be merged in the next Imaging release. Waiting this next release, I’m searching for a method to patch an egg before it is compiled by zc.buildout.

Update: this patch is included in PIL 1.1.7beta1

6 Responses to Fix PIL 1.1.6 installation from sources under debian

  1. Steve McMahon dit :

    Before switching to use PILwoTK, the Unified Installer used to do this:

    # force no build of tk support; this has caused problems
    # on some platforms, and Plone doesn’t need it.
    mv setup.py setup.py.tmp
    SED_CMD= »s|^ _tkinter = None\s*$| _tkinter = None\n_tkinter = None|; »
    cat setup.py.tmp | sed -e « $SED_CMD » > setup.py

  2. encolpe dit :

    My last action was to unarchive the PIL egg in my cache then patch it and rebuild the archive.

  3. RaiulBaztepo dit :

    Hello!
    Very Interesting post! Thank you for such interesting resource!
    PS: Sorry for my bad english, I’v just started to learn this language😉
    See you!
    Your, Raiul Baztepo

  4. encolpe dit :

    The fix is now included in the next PIL release.

  5. Fahad Yousuf dit :

    $ /pkgs/Imaging-1.1.6# patch setup.py setup.patch
    patching file setup.py
    patch: **** malformed patch at line 6: add_directory(library_dirs, « /usr/lib »)

    Any ideas?

%d blogueurs aiment cette page :