From 3d61b3a3c00d41a6e0336ad495e71cc01a37ed4a Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Thu, 23 Dec 2010 22:25:23 +0100 Subject: [PATCH] Get rid of ltihooks.py. ltihooks.py apparently breaks the import mechanisms of Python 2.6, causes SWIG's runtime to fail to share a global type table, and yields various failures in our tests. * wrap/python/ltihooks.py: Delete. * wrap/python/Makefile.am (EXTRA_DIST): remove ltihooks.py. * wrap/python/tests/bddnqueen.py, wrap/python/tests/interdep.py, wrap/python/tests/ltl2tgba.py, wrap/python/tests/ltlparse.py, wrap/python/tests/ltlsimple.py, wrap/python/tests/minato.py, wrap/python/tests/modgray.py, wrap/python/tests/optionmap.py, wrap/python/tests/setxor.py: Do not use ltihooks. * wrap/python/tests/run.in (pypath): Include the .libs/ directory in the search path so that Python can find the *.so libraries. --- ChangeLog | 20 +++++++++++ wrap/python/Makefile.am | 2 +- wrap/python/cgi-bin/ltl2tgba.in | 3 +- wrap/python/ltihooks.py | 60 --------------------------------- wrap/python/tests/bddnqueen.py | 3 +- wrap/python/tests/interdep.py | 5 ++- wrap/python/tests/ltl2tgba.py | 3 +- wrap/python/tests/ltlparse.py | 3 +- wrap/python/tests/ltlsimple.py | 3 +- wrap/python/tests/minato.py | 3 +- wrap/python/tests/modgray.py | 3 +- wrap/python/tests/optionmap.py | 3 +- wrap/python/tests/run.in | 15 ++++++--- wrap/python/tests/setxor.py | 1 - 14 files changed, 43 insertions(+), 84 deletions(-) delete mode 100755 wrap/python/ltihooks.py diff --git a/ChangeLog b/ChangeLog index 23cd7210b..a91afc12c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2010-12-23 Alexandre Duret-Lutz + + Get rid of ltihooks.py. + + ltihooks.py apparently breaks the import mechanisms of Python 2.6, + causes SWIG's runtime to fail to share a global type table, and + yields various failures in our tests. + + * wrap/python/ltihooks.py: Delete. + * wrap/python/Makefile.am (EXTRA_DIST): remove ltihooks.py. + * wrap/python/tests/bddnqueen.py, wrap/python/tests/interdep.py, + wrap/python/tests/ltl2tgba.py, wrap/python/tests/ltlparse.py, + wrap/python/tests/ltlsimple.py, wrap/python/tests/minato.py, + wrap/python/tests/modgray.py, wrap/python/tests/optionmap.py, + wrap/python/tests/setxor.py: Do not use ltihooks. + * wrap/python/tests/run.in (pypath): Include the .libs/ directories + in the search path so that Python can find the *.so libraries. + * wrap/python/cgi-bin/ltl2tgba.in: Insert the .libs/ directories + into sys.path instead of importing ltihooks. + 2010-12-12 Alexandre Duret-Lutz * NEWS: Summarize recent changes. diff --git a/wrap/python/Makefile.am b/wrap/python/Makefile.am index 84ec36a1d..f32db2d10 100644 --- a/wrap/python/Makefile.am +++ b/wrap/python/Makefile.am @@ -25,7 +25,7 @@ SUBDIRS = . cgi-bin tests AM_CPPFLAGS = -I$(PYTHONINC) -I$(top_srcdir)/src $(BUDDY_CPPFLAGS) -EXTRA_DIST = ltihooks.py spot.i buddy.i +EXTRA_DIST = spot.i buddy.i python_PYTHON = $(srcdir)/spot.py $(srcdir)/buddy.py pyexec_LTLIBRARIES = _spot.la _buddy.la diff --git a/wrap/python/cgi-bin/ltl2tgba.in b/wrap/python/cgi-bin/ltl2tgba.in index dd65c1ebd..fe0c8eaa3 100755 --- a/wrap/python/cgi-bin/ltl2tgba.in +++ b/wrap/python/cgi-bin/ltl2tgba.in @@ -69,14 +69,15 @@ if (os.environ.has_key('SERVER_SOFTWARE') and # Add the build and source directories first in the search path. # If we are not in the right place, python will find the installed # libraries later. + sys.path.insert(0, '@srcdir@/../.libs') sys.path.insert(0, '@srcdir@/..') + sys.path.insert(0, '../.libs') sys.path.insert(0, '..') # Darwin needs some help in figuring out where non-installed libtool # libraries are (on this platform libtool encodes the expected final # path of dependent libraries in each library). m = '../.libs:@top_builddir@/src/.libs:@top_builddir@/buddy/src/.libs' os.environ['DYLD_LIBRARY_PATH'] = m - import ltihooks # Extra HTML headers. extra_header = '' diff --git a/wrap/python/ltihooks.py b/wrap/python/ltihooks.py deleted file mode 100755 index 7086365df..000000000 --- a/wrap/python/ltihooks.py +++ /dev/null @@ -1,60 +0,0 @@ -# -*- Mode: Python; py-indent-offset: 4 -*- -# ltihooks.py: python import hooks that understand libtool libraries. -# Copyright (C) 2000 James Henstridge. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -import os, ihooks - -class LibtoolHooks(ihooks.Hooks): - def get_suffixes(self): - """Like normal get_suffixes, but adds .la suffixes to list""" - ret = ihooks.Hooks.get_suffixes(self) - ret.insert(0, ('module.la', 'rb', 3)) - ret.insert(0, ('.la', 'rb', 3)) - return ret - - def load_dynamic(self, name, filename, file=None): - """Like normal load_dynamic, but treat .la files specially""" - if len(filename) > 3 and filename[-3:] == '.la': - fp = open(filename, 'r') - dlname = '' - installed = 1 - line = fp.readline() - while line: - if len(line) > 7 and line[:7] == 'dlname=': - dlname = line[8:-2] - elif len(line) > 10 and line[:10] == 'installed=': - installed = line[10:-1] == 'yes' - line = fp.readline() - fp.close() - if dlname: - if installed: - filename = os.path.join(os.path.dirname(filename), - dlname) - else: - filename = os.path.join(os.path.dirname(filename), - '.libs', dlname) - return ihooks.Hooks.load_dynamic(self, name, filename, file) - -importer = ihooks.ModuleImporter() -importer.set_hooks(LibtoolHooks()) - -def install(): - importer.install() -def uninstall(): - importer.uninstall() - -install() diff --git a/wrap/python/tests/bddnqueen.py b/wrap/python/tests/bddnqueen.py index 0a25550dd..559055630 100755 --- a/wrap/python/tests/bddnqueen.py +++ b/wrap/python/tests/bddnqueen.py @@ -1,5 +1,5 @@ # -*- mode: python; coding: iso-8859-1 -*- -# Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6), +# Copyright (C) 2003, 2004, 2010 Laboratoire d'Informatique de Paris 6 (LIP6), # département Systèmes Répartis Coopératifs (SRC), Université Pierre # et Marie Curie. # @@ -23,7 +23,6 @@ # Python translation of the C++ example from the BuDDy distribution. # (compare with buddy/examples/queen/queen.cxx) -import ltihooks import sys from buddy import * diff --git a/wrap/python/tests/interdep.py b/wrap/python/tests/interdep.py index 721df3bb3..87dfacad5 100755 --- a/wrap/python/tests/interdep.py +++ b/wrap/python/tests/interdep.py @@ -1,5 +1,5 @@ # -*- mode: python; coding: iso-8859-1 -*- -# Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6), +# Copyright (C) 2003, 2004, 2010 Laboratoire d'Informatique de Paris 6 (LIP6), # département Systèmes Répartis Coopératifs (SRC), Université Pierre # et Marie Curie. # @@ -22,9 +22,8 @@ # Make sure that interdependencies between the spot and buddy wrappers # are not problematic. -import ltihooks -import spot import buddy +import spot e = spot.default_environment.instance() p = spot.empty_parse_error_list() f = spot.parse('GFa', p, e) diff --git a/wrap/python/tests/ltl2tgba.py b/wrap/python/tests/ltl2tgba.py index 9e206916a..d8f07a7fe 100755 --- a/wrap/python/tests/ltl2tgba.py +++ b/wrap/python/tests/ltl2tgba.py @@ -1,5 +1,5 @@ # -*- mode: python; coding: iso-8859-1 -*- -# Copyright (C) 2009 Laboratoire de Recherche et Développement +# Copyright (C) 2009, 2010 Laboratoire de Recherche et Développement # de l'Epita (LRDE). # Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6), # département Systèmes Répartis Coopératifs (SRC), Université Pierre @@ -27,7 +27,6 @@ import sys import getopt -import ltihooks import spot def usage(prog): diff --git a/wrap/python/tests/ltlparse.py b/wrap/python/tests/ltlparse.py index 4f9527208..e67c64557 100755 --- a/wrap/python/tests/ltlparse.py +++ b/wrap/python/tests/ltlparse.py @@ -1,5 +1,5 @@ # -*- mode: python; coding: iso-8859-1 -*- -# Copyright (C) 2009 Laboratoire de Recherche et Développement +# Copyright (C) 2009, 2010 Laboratoire de Recherche et Développement # de l'Epita (LRDE). # Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6), # département Systèmes Répartis Coopératifs (SRC), Université Pierre @@ -23,7 +23,6 @@ # 02111-1307, USA. import sys -import ltihooks import spot e = spot.default_environment.instance() diff --git a/wrap/python/tests/ltlsimple.py b/wrap/python/tests/ltlsimple.py index a700bb536..6091f7881 100755 --- a/wrap/python/tests/ltlsimple.py +++ b/wrap/python/tests/ltlsimple.py @@ -1,5 +1,5 @@ # -*- mode: python; coding: iso-8859-1 -*- -# Copyright (C) 2009 Laboratoire de Recherche et Développement +# Copyright (C) 2009, 2010 Laboratoire de Recherche et Développement # de l'Epita (LRDE). # Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6), # département Systèmes Répartis Coopératifs (SRC), Université Pierre @@ -22,7 +22,6 @@ # Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. -import ltihooks import spot e = spot.default_environment.instance() diff --git a/wrap/python/tests/minato.py b/wrap/python/tests/minato.py index 41705a1cc..71b1bdd9d 100755 --- a/wrap/python/tests/minato.py +++ b/wrap/python/tests/minato.py @@ -1,5 +1,5 @@ # -*- mode: python; coding: iso-8859-1 -*- -# Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6), +# Copyright (C) 2004, 2010 Laboratoire d'Informatique de Paris 6 (LIP6), # département Systèmes Répartis Coopératifs (SRC), Université Pierre # et Marie Curie. # @@ -20,7 +20,6 @@ # Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. -import ltihooks import spot import buddy import sys diff --git a/wrap/python/tests/modgray.py b/wrap/python/tests/modgray.py index 3c10b09b9..72ba1d5d2 100755 --- a/wrap/python/tests/modgray.py +++ b/wrap/python/tests/modgray.py @@ -1,5 +1,5 @@ # -*- mode: python; coding: iso-8859-1 -*- -# Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6), +# Copyright (C) 2004, 2010 Laboratoire d'Informatique de Paris 6 (LIP6), # département Systèmes Répartis Coopératifs (SRC), Université Pierre # et Marie Curie. # @@ -20,7 +20,6 @@ # Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. -import ltihooks import spot class test(spot.loopless_modular_mixed_radix_gray_code): diff --git a/wrap/python/tests/optionmap.py b/wrap/python/tests/optionmap.py index eaaabd01a..066edb5f8 100755 --- a/wrap/python/tests/optionmap.py +++ b/wrap/python/tests/optionmap.py @@ -1,5 +1,5 @@ # -*- mode: python; coding: iso-8859-1 -*- -# Copyright (C) 2005 Laboratoire d'Informatique de Paris 6 (LIP6), +# Copyright (C) 2005, 2010 Laboratoire d'Informatique de Paris 6 (LIP6), # département Systèmes Répartis Coopératifs (SRC), Université Pierre # et Marie Curie. # @@ -20,7 +20,6 @@ # Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. -import ltihooks import spot o = spot.option_map() diff --git a/wrap/python/tests/run.in b/wrap/python/tests/run.in index 64d92c19f..c6a055569 100644 --- a/wrap/python/tests/run.in +++ b/wrap/python/tests/run.in @@ -1,7 +1,10 @@ #!/bin/sh -# Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6), -# département Systèmes Répartis Coopératifs (SRC), Université Pierre -# et Marie Curie. + +# Copyright (C) 2010 Laboratoire de Recherche et Developpement de +# l'EPITA (LRDE). +# Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 +# (LIP6), département Systèmes Répartis Coopératifs (SRC), Université +# Pierre et Marie Curie. # # This file is part of Spot, a model checking library. # @@ -30,7 +33,11 @@ test -n "$srcdir" && test -z "$VERBOSE" && exec >/dev/null 2>&1 # path of dependent libraries in each library). modpath='../.libs:@top_builddir@/src/.libs:@top_builddir@/buddy/src/.libs' -pypath='..:@srcdir@/..:$PYTHONPATH' +# .. is for the *.py files, and ../.libs for the *.so. We used to +# rely on a module called ltihooks.py to teach the import function how +# to load a Libtool library, but it started to cause issues with +# Python 2.6. +pypath='..:../.libs:@srcdir@/..:@srcdir@/../.libs:$PYTHONPATH' test -z "$1" && PYTHONPATH=$pypath DYLD_LIBRARY_PATH=$modpath exec @PYTHON@ diff --git a/wrap/python/tests/setxor.py b/wrap/python/tests/setxor.py index 05856bf32..e55d9914a 100755 --- a/wrap/python/tests/setxor.py +++ b/wrap/python/tests/setxor.py @@ -18,7 +18,6 @@ # Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. -import ltihooks import sys from buddy import *