[Python-modules-commits] r1247 - in /packages/ipython/trunk/debian:
changelog patches/00list patches/03_fix-inspect-module.dpatch
nobse at users.alioth.debian.org
nobse at users.alioth.debian.org
Thu Aug 10 16:58:17 UTC 2006
Author: nobse
Date: Thu Aug 10 16:58:16 2006
New Revision: 1247
URL: http://svn.debian.org/wsvn/python-modules/?sc=1&rev=1247
Log:
Added a new patch from svn to workaround bugs in python 2.3's inspect module.
Added:
packages/ipython/trunk/debian/patches/03_fix-inspect-module.dpatch
Modified:
packages/ipython/trunk/debian/changelog
packages/ipython/trunk/debian/patches/00list
Modified: packages/ipython/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/python-modules/packages/ipython/trunk/debian/changelog?rev=1247&op=diff
==============================================================================
--- packages/ipython/trunk/debian/changelog (original)
+++ packages/ipython/trunk/debian/changelog Thu Aug 10 16:58:16 2006
@@ -1,3 +1,10 @@
+ipython (0.7.2-5) UNRELEASED; urgency=low
+
+ * Added a new patch from svn to workaround bugs in python 2.3's inspect
+ module. (closes: #374625)
+
+ -- Norbert Tretkowski <nobse at debian.org> Thu, 10 Aug 2006 18:36:12 +0200
+
ipython (0.7.2-4) unstable; urgency=low
* Fixed spelling error in description. (closes: #363976)
Modified: packages/ipython/trunk/debian/patches/00list
URL: http://svn.debian.org/wsvn/python-modules/packages/ipython/trunk/debian/patches/00list?rev=1247&op=diff
==============================================================================
--- packages/ipython/trunk/debian/patches/00list (original)
+++ packages/ipython/trunk/debian/patches/00list Thu Aug 10 16:58:16 2006
@@ -1,2 +1,3 @@
01_docdir-base
02_profiler-message
+03_fix-inspect-module
Added: packages/ipython/trunk/debian/patches/03_fix-inspect-module.dpatch
URL: http://svn.debian.org/wsvn/python-modules/packages/ipython/trunk/debian/patches/03_fix-inspect-module.dpatch?rev=1247&op=file
==============================================================================
--- packages/ipython/trunk/debian/patches/03_fix-inspect-module.dpatch (added)
+++ packages/ipython/trunk/debian/patches/03_fix-inspect-module.dpatch Thu Aug 10 16:58:16 2006
@@ -1,0 +1,65 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 03_fix-inspect-module.dpatch by Fernando Perez <fperez.net at gmail.com>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: This is a crude fix for bugs in python 2.3's inspect module. We
+## DP: simply monkeypatch inspect with code copied from python 2.4.
+
+ at DPATCH@
+diff -Nur ipython-0.7.2.orig/IPython/OInspect.py ipython-0.7.2/IPython/OInspect.py
+--- ipython-0.7.2.orig/IPython/OInspect.py 2006-05-26 09:52:53.000000000 +0200
++++ ipython-0.7.2/IPython/OInspect.py 2006-08-10 18:33:24.000000000 +0200
+@@ -30,6 +30,7 @@
+ import StringIO
+ import types
+ import os
++import sys
+ # IPython's own
+ from IPython import PyColorize
+ from IPython.genutils import page,indent,Term,mkdict
+@@ -38,6 +39,45 @@
+ from IPython.ColorANSI import *
+
+ #****************************************************************************
++# HACK!!! This is a crude fix for bugs in python 2.3's inspect module. We
++# simply monkeypatch inspect with code copied from python 2.4.
++if sys.version_info[:2] == (2,3):
++ from inspect import ismodule, getabsfile, modulesbyfile
++ def getmodule(object):
++ """Return the module an object was defined in, or None if not found."""
++ if ismodule(object):
++ return object
++ if hasattr(object, '__module__'):
++ return sys.modules.get(object.__module__)
++ try:
++ file = getabsfile(object)
++ except TypeError:
++ return None
++ if file in modulesbyfile:
++ return sys.modules.get(modulesbyfile[file])
++ for module in sys.modules.values():
++ if hasattr(module, '__file__'):
++ modulesbyfile[
++ os.path.realpath(
++ getabsfile(module))] = module.__name__
++ if file in modulesbyfile:
++ return sys.modules.get(modulesbyfile[file])
++ main = sys.modules['__main__']
++ if not hasattr(object, '__name__'):
++ return None
++ if hasattr(main, object.__name__):
++ mainobject = getattr(main, object.__name__)
++ if mainobject is object:
++ return main
++ builtin = sys.modules['__builtin__']
++ if hasattr(builtin, object.__name__):
++ builtinobject = getattr(builtin, object.__name__)
++ if builtinobject is object:
++ return builtin
++
++ inspect.getmodule = getmodule
++
++#****************************************************************************
+ # Builtin color schemes
+
+ Colors = TermColors # just a shorthand
More information about the Python-modules-commits
mailing list