* python/ltihooks.py: Remove. * python/Makefile.am (python_PYTHON): Remove ltihooks.py. * python/swilena.py: No longer import `ltihooks'. * run.in: Help Python find actual dynamic modules in directory `.libs', as suggested by Alexandre Duret-Lutz in http://stackoverflow.com/a/5125879/1551751. --- swilena/ChangeLog | 11 ++++++++ swilena/python/Makefile.am | 4 +-- swilena/python/ltihooks.py | 60 -------------------------------------------- swilena/python/swilena.py | 4 +-- swilena/run.in | 46 +++++++++++++++++---------------- 5 files changed, 37 insertions(+), 88 deletions(-) delete mode 100644 swilena/python/ltihooks.py
diff --git a/swilena/ChangeLog b/swilena/ChangeLog index 9bb6539..6781d78 100644 --- a/swilena/ChangeLog +++ b/swilena/ChangeLog @@ -1,3 +1,14 @@ +2012-07-27 Roland Levillain roland@lrde.epita.fr + + Get rid of `ltihooks' in Swilena. + + * python/ltihooks.py: Remove. + * python/Makefile.am (python_PYTHON): Remove ltihooks.py. + * python/swilena.py: No longer import `ltihooks'. + * run.in: Help Python find actual dynamic modules in directory + `.libs', as suggested by Alexandre Duret-Lutz in + http://stackoverflow.com/a/5125879/1551751. + 2010-12-03 Roland Levillain roland@lrde.epita.fr
Perform install tests in Swilena. diff --git a/swilena/python/Makefile.am b/swilena/python/Makefile.am index 9f3c5fb..73ca060 100644 --- a/swilena/python/Makefile.am +++ b/swilena/python/Makefile.am @@ -53,10 +53,8 @@ edit = sed \ -e 's|@PYTHON[@]|$(PYTHON)|g'
-# ltihooks.py: Python import hooks that understand Libtool libraries. -python_PYTHON = ltihooks.py # swilena.py: The whole Swilena suite. -python_PYTHON += swilena.py +python_PYTHON = swilena.py
# data.py: Access to the data of the distribution (images, meshes, # etc.). diff --git a/swilena/python/ltihooks.py b/swilena/python/ltihooks.py deleted file mode 100644 index 7086365..0000000 --- a/swilena/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/swilena/python/swilena.py b/swilena/python/swilena.py index 260c4ce..969a2a1 100644 --- a/swilena/python/swilena.py +++ b/swilena/python/swilena.py @@ -1,6 +1,6 @@ #! /usr/bin/env python
-# Copyright (C) 2008, 2009, 2010, 2013 EPITA Research and Development +# Copyright (C) 2008, 2009, 2010, 2012, 2013 EPITA Research and Development # Laboratory (LRDE) # # This file is part of Olena. @@ -20,8 +20,6 @@ # \file swilena.py # \brief The whole Swilena suite.
-import ltihooks - import config
from complex2 import * diff --git a/swilena/run.in b/swilena/run.in index 2f01b29..0a76964 100755 --- a/swilena/run.in +++ b/swilena/run.in @@ -1,7 +1,8 @@ -#!/bin/sh -# Copyright (C) 2003, 2004, 2006 Laboratoire d'Informatique de Paris 6 -# (LIP6), département Systèmes Répartis Coopératifs (SRC), Université -# Pierre et Marie Curie. +#! /bin/sh + +# Copyright (C) 2003, 2004, 2006, 2012 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,28 +31,29 @@ test -n "$srcdir" && test -z "$VERBOSE" && exec >/dev/null 2>&1 # path of dependent libraries in each library). modpath='.libs:@abs_top_builddir@/src/.libs'
+# `@abs_builddir@/python' and `@abs_srcdir@/python' are for the *.py +# files, and `@abs_builddir@/python/.libs' for the *.so files. We +# used to rely on a module called `ltihooks' to teach the `import' +# statement how to load a Libtool library, but it started to cause +# issues with Python 2.6. +pypath='@abs_builddir@/python:@abs_builddir@/python/.libs:@abs_srcdir@/python':"$PYTHONPATH" + +# Likewise for Ruby: as some of our SWIG interfaces import other SWIG +# interfaces (with the `%import' keyword), we must add the `.libs' +# directory to SWILENA_RUBY_PATH so that the Ruby interpreter can load +# the corresponding dynamic module(s) (SWIG's `%import' statements +# generate code in dynamic modules that bypass Ruby's `Kernel.require' +# mechanism). +rbpath='@abs_builddir@/ruby:@abs_builddir@/ruby/.libs:@abs_srcdir@/ruby' + case $1 in - '' | *.py) - PYTHONPATH='@abs_builddir@/python:@abs_srcdir@/python':"$PYTHONPATH" \ - DYLD_LIBRARY_PATH=$modpath \ - exec @PYTHON@ "$@" - ;; - # What's the point in adding `.libs' to SWILENA_RUBY_PATH? - # - # As some of our SWIG interfaces import other SWIG interfaces - # (with the `%import' keyword), we must add the `.libs' directory - # to SWILENA_RUBY_PATH so that the Ruby interpreter can load the - # corresponding dynamic module(s) (SWIG's `%import' statements - # generate code in dynamic modules that bypass Ruby's - # `Kernel.require' mechanism). + *.py) + PYTHONPATH=$pypath DYLD_LIBRARY_PATH=$modpath exec @PYTHON@ "$@";; *.rb) - SWILENA_RUBY_PATH='@abs_builddir@/ruby:@abs_srcdir@/ruby:.libs' \ - DYLD_LIBRARY_PATH=$modpath \ - exec @RUBY@ "$@" - ;; + SWILENA_RUBY_PATH=$rbpath DYLD_LIBRARY_PATH=$modpath exec @RUBY@ "$@";; *.test) exec sh -x "$@";; *) - echo "Unknown extension" 2>&1 + echo "Unknown extension" >&2 exit 2;; esac