$OpenBSD: patch-setupext_py,v 1.12 2012/02/28 23:01:23 rpointel Exp $ --- setupext.py.orig Fri Dec 19 05:34:22 2008 +++ setupext.py Tue Feb 28 23:26:18 2012 @@ -46,6 +46,7 @@ import re import subprocess basedir = { + 'openbsd5' : [os.getenv('X11BASE') or '/usr/X11R6', os.getenv('LOCALBASE') or '/usr/local', '/usr',], 'win32' : ['win32_static',], 'linux2' : ['/usr/local', '/usr'], 'linux' : ['/usr/local', '/usr',], @@ -317,6 +318,8 @@ def check_for_libpng(): def add_base_flags(module): incdirs = filter(os.path.exists, [os.path.join(p, 'include') for p in basedir[sys.platform] ]) + if os.getenv('EXTRA_INCLUDES') is not None: + incdirs += os.getenv('EXTRA_INCLUDES').split() libdirs = filter(os.path.exists, [os.path.join(p, 'lib') for p in basedir[sys.platform] ]+ [os.path.join(p, 'lib64') for p in basedir[sys.platform] ] ) @@ -560,14 +563,16 @@ def check_for_gtk(): gotit = False explanation = None try: - import gtk + # the following import requires X11 at build time + #import gtk + gotit = True except ImportError: explanation = 'Building for Gtk+ requires pygtk; you must be able to "import gtk" in your build/install environment' except RuntimeError: explanation = 'pygtk present but import failed' else: version = (2,2,0) - if gtk.pygtk_version < version: + if False: explanation = "Error: GTK backend requires PyGTK %d.%d.%d (or later), " \ "%d.%d.%d was detected." % ( version + gtk.pygtk_version) @@ -593,8 +598,8 @@ def check_for_gtk(): else: pygobject_version = '[pre-pygobject]' print_status("Gtk+", "gtk+: %s, glib: %s, pygtk: %s, pygobject: %s" % - (ver2str(gtk.gtk_version), ver2str(gobject.glib_version), - ver2str(gtk.pygtk_version), pygobject_version)) + ("unknown", ver2str(gobject.glib_version), + "unknown", pygobject_version)) else: print_status("Gtk+", "no") @@ -635,7 +640,8 @@ def add_pygtk_flags(module): pygtkIncludes = getoutput('pkg-config --cflags-only-I pygtk-2.0').split() gtkIncludes = getoutput('pkg-config --cflags-only-I gtk+-2.0').split() includes = pygtkIncludes + gtkIncludes - module.include_dirs.extend([include[2:] for include in includes]) + module.include_dirs = [include[2:] for include in includes] + \ + module.include_dirs pygtkLinker = getoutput('pkg-config --libs pygtk-2.0').split() gtkLinker = getoutput('pkg-config --libs gtk+-2.0').split() @@ -784,6 +790,7 @@ def check_for_tk(): explanation = str(e) gotit = False else: + add_pygtk_flags(module) if not find_include_file(module.include_dirs, "tk.h"): message = 'Tkinter present, but header files are not found. ' + \ 'You may need to install development packages.' @@ -794,8 +801,13 @@ def check_for_tk(): gotit = False if gotit: + try: + tk_v = Tkinter.__version__.split()[-2] + except (AttributeError, IndexError): + # Tkinter.__version__ has been removed in python 3 + tk_v = 'version not identified' print_status("Tkinter", "Tkinter: %s, Tk: %s, Tcl: %s" % - (Tkinter.__version__.split()[-2], Tkinter.TkVersion, Tkinter.TclVersion)) + (tk_v, Tkinter.TkVersion, Tkinter.TclVersion)) else: print_status("Tkinter", "no") if explanation is not None: @@ -1051,7 +1063,8 @@ so that setup can determine where your libraries are l tcl_lib, tcl_inc, tk_lib, tk_inc = result module.include_dirs.extend([tcl_inc, tk_inc]) module.library_dirs.extend([tcl_lib, tk_lib]) - module.libraries.extend(['tk' + tk_ver, 'tcl' + tk_ver]) + module.libraries.extend(['tk' + tk_ver.replace('.', ''), + 'tcl' + tk_ver.replace('.', '')]) return message