From dd2009d4e0e9fa9cd4ee8d76ec0e498e62a568b7 Mon Sep 17 00:00:00 2001 From: Paul Pogonyshev Date: Sat, 02 May 2009 13:11:06 +0000 Subject: Remove 'ltihooks.py' as using deprecated Python module. Remove the script and all related imports. All relevant Makefile's now create symbolic links for '.so' files from '.libs' to the level up, so that C helper modules are still importable in built, but not installed source tree. Same as in PyGObject. (Bug #565593.) --- diff --git a/Makefile.am b/Makefile.am index 1ed5196..2472727 100644 --- a/Makefile.am +++ b/Makefile.am @@ -44,10 +44,6 @@ pkgconfig_DATA += pygtk-$(PLATFORM_VERSION).pc defsdir = $(pkgdatadir)/$(PLATFORM_VERSION)/defs defs_DATA = -# python -pyexec_LTLIBRARIES = -noinst_PYTHON = ltihooks.py - # pygtk scripts pkgpythondir = $(pyexecdir)/gtk-2.0 @@ -141,3 +137,10 @@ doc-dist: cp -r docs/cursors/* pygtk/cursors tar cfz $(PACKAGE)-docs.tar.gz pygtk rm -fr pygtk + + +all: $(pkgpyexec_LTLIBRARIES:.la=.so) +clean-local: + rm -f $(pkgpyexec_LTLIBRARIES:.la=.so) +.la.so: + $(LN_S) .libs/$@ $@ || true diff --git a/gtk/Makefile.am b/gtk/Makefile.am index 2021220..b9ec8f3 100644 --- a/gtk/Makefile.am +++ b/gtk/Makefile.am @@ -195,7 +195,7 @@ CLEANFILES += \ gtkunixprint.c \ gtkunixprint.defs \ gtkunixprint-types.defs - + EXTRA_DIST += \ $(GTKUNIXPRINT_DEFS) \ @@ -248,3 +248,9 @@ endif gtk-types.c: @: + +all: $(pygtkexec_LTLIBRARIES:.la=.so) $(pkgpyexec_LTLIBRARIES:.la=.so) +clean-local: + rm -f $(pygtkexec_LTLIBRARIES:.la=.so) $(pkgpyexec_LTLIBRARIES:.la=.so) +.la.so: + $(LN_S) .libs/$@ $@ || true diff --git a/gtk/__init__.py b/gtk/__init__.py index e2733dc..92af869 100644 --- a/gtk/__init__.py +++ b/gtk/__init__.py @@ -22,14 +22,6 @@ import sys -# this can go when things are a little further along -try: - import ltihooks - # pyflakes - ltihooks -except ImportError: - ltihooks = None - # For broken embedded programs which forgot to call Sys_SetArgv if not hasattr(sys, 'argv'): sys.argv = [] @@ -49,13 +41,6 @@ else: import gdk -if ltihooks: - try: - ltihooks.uninstall() - del ltihooks - except: - pass - from gtk._lazyutils import LazyNamespace, LazyModule from gtk.deprecation import _Deprecated, _DeprecatedConstant diff --git a/tests/common.py b/tests/common.py index dfc3401..33216e1 100644 --- a/tests/common.py +++ b/tests/common.py @@ -7,29 +7,19 @@ def importModules(buildDir, srcDir): # Be very careful when you change this code, it's # fragile and the order is really significant - # ltihooks - sys.path.insert(0, srcDir) # atk, pango sys.path.insert(0, buildDir) # _gtk, keysyms, glade sys.path.insert(0, os.path.join(buildDir, 'gtk')) sys.argv.append('--g-fatal-warnings') - import ltihooks atk = importModule('atk', buildDir) pango = importModule('pango', buildDir) gtk = importModule('gtk', buildDir, 'gtk') gdk = importModule('gtk.gdk', buildDir, '_gdk.la') - # gtk/__init__.py removes the ltihooks, readd them - import gtk - - ltihooks.install() glade = importModule('gtk.glade', buildDir) - ltihooks.uninstall() - del ltihooks - globals().update(locals()) os.environ['PYGTK_USE_GIL_STATE_API'] = '' -- cgit v0.8.2 --- a/ltihooks.py 2009-03-05 23:06:53.000000000 +0100 +++ b/dev/null 2009-05-02 19:22:42.444026449 +0200 @@ -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()