[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Error building package (uses python)



Hi Brian, 

On Tue, Apr 22, 2003 at 09:08:57AM -0400, fbrian@nac.net wrote:
> I have a package that I am getting ready for my sponsor to upload.
> I began getting these errors when I upgraded my python debs from stable to
> the unstable versions.
> 
> checking for gtk.py... no
> configure: error:
> **** The python interpreter can't find the python bindings for gtk.

Hmpf. Reminds me of the odd situation of pygtk in Debian. Currently 
the gtk 1.2 bindings are still the default. Probably that should be
fixed. 

> Here is a list of the debs I have installed.

This throws up the question if you need the gtk 1.2 or 2.0 bindings
for that tool...

> Here is the build error I get.
> checking for gtk.py... no
> configure: error:
> **** The python interpreter can't find the python bindings for gtk.

Argh. Whoever wrote that script should be larted. Because the error
message does not match reality. In fact, configure.in does not ask the
python interpreter to find gtk.py:

    dnl Check if python bindings for gtk are installed

    AC_CHECK_PROG(have_pygtk, gtk.py, yes, no, $PYTHON_SITE_DIR)

    if test "x$have_pygtk" != xyes
    then
       AC_MSG_ERROR([
    **** The python interpreter can't find the python bindings for gtk.])
    fi

Where does that call python? In fact, even $PYTHON_SITE_DIR does not
make much sense. In realitas python searches in a number of paths which 
can be adjusted by throwing a file with extension .pth in there, like
python-gtk does:

torsten@pulsar:~$ dpkg -L python-gtk|grep pygtk.pth
/usr/lib/python2.2/site-packages/pygtk.pth
torsten@pulsar:~$ cat /usr/lib/python2.2/site-packages/pygtk.pth
gtk-1.2

This results in the following search list in python:

torsten@pulsar:~$ python -c "import sys; print sys.path"
['', '/usr/lib/python2.2', '/usr/lib/python2.2/plat-linux2',
'/usr/lib/python2.2/lib-tk', '/usr/lib/python2.2/lib-dynload',
'/usr/local/lib/python2.2/site-packages', '/usr/local/lib/site-python',
'/usr/lib/python2.2/site-packages',
'/usr/lib/python2.2/site-packages/Numeric',
'/usr/lib/python2.2/site-packages/PIL',
'/usr/lib/python2.2/site-packages/gtk-1.2', '/usr/lib/site-python']

This is what the script should check for. Or, just use python to figure
out the path:

code="
import sys
try:
  import gtk
except ImportError:
  sys.exit(1)
except:
  sys.exit(0)
sys.exit(0)"
if $PYTHON -c "$code"; then
  AC_MSG_RESULT(yes)
else
  AC_MSG_ERROR("no gtk.py found")
fi

Something along the lines - did not write autoconf for a while...

Greetings

	Torsten (python-gtk maintainer)

Attachment: pgp_ocObSXlM3.pgp
Description: PGP signature


Reply to: