Tk build problem on Ubuntu Hardy

Hi all,

just a heads up: current MPL from SVN won't build the Tk backend on an
ubuntu hardy installation (32 bit) because the location of certain
paths seems to have changed. I got it down to this snippet:

import Tkinter
tk = Tkinter.Tk()
tk.withdraw()
print tk.getvar('tcl_library')

On a gutsy box I get:
/usr/lib/tcl8.4

but hardy now reports:
/usr/share/tcltk/tcl8.4

This seems to foul up the path handling code in add_tk_flags(), so in
the end the created extension module object (in check_for_tk) ends up
with:

In [21]: module.include_dirs
Out[21]: ['/usr/share/include', '/usr/share/include']

This obviously means that the headers for Tk aren't found, since they
live in /usr/include:

/usr/include/tcl8.4/tk.h

The code for this path detection is obviously rather convoluted and
brittle, since there seems to be no clear API provided by Tk for this
information, unfortunately. This could be a Hardy bug, for all I know.
I just wanted to let you guys know, for now I'll brute-force patch my
local copy so I can build.

Cheers,

f

FWIW -- this is what the Ubuntu package diff does to setupext.py. We may want to do the same:

+@@ -960,6 +960,9 @@ def add_tk_flags(module):
+ if not os.path.exists(tk_inc):
+ tk_inc = os.path.normpath(os.path.join(tk_lib_dir,
+ '../../include'))
++ if not os.path.exists(tk_inc):
++ tk_inc = os.path.normpath(os.path.join(tk_lib_dir,
++ '../../../include/tcl' + tk_ver))

ยทยทยท

+ + if ((not os.path.exists(os.path.join(tk_inc,'tk.h'))) and
+ os.path.exists(os.path.join(tcl_inc,'tk.h'))):
+

For more info, see here:

https://launchpad.net/ubuntu/+source/matplotlib/0.91.2-0ubuntu1

Cheers,
Mike

Fernando Perez wrote:

Hi all,

just a heads up: current MPL from SVN won't build the Tk backend on an
ubuntu hardy installation (32 bit) because the location of certain
paths seems to have changed. I got it down to this snippet:

import Tkinter
tk = Tkinter.Tk()
tk.withdraw()
print tk.getvar('tcl_library')

On a gutsy box I get:
/usr/lib/tcl8.4

but hardy now reports:
/usr/share/tcltk/tcl8.4

This seems to foul up the path handling code in add_tk_flags(), so in
the end the created extension module object (in check_for_tk) ends up
with:

In [21]: module.include_dirs
Out[21]: ['/usr/share/include', '/usr/share/include']

This obviously means that the headers for Tk aren't found, since they
live in /usr/include:

/usr/include/tcl8.4/tk.h

The code for this path detection is obviously rather convoluted and
brittle, since there seems to be no clear API provided by Tk for this
information, unfortunately. This could be a Hardy bug, for all I know.
I just wanted to let you guys know, for now I'll brute-force patch my
local copy so I can build.

Cheers,

f

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
matplotlib-devel List Signup and Options
  
--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA