tags 294500 patch
thanks
Please apply the attached patch to Magic.py to make profiling support optional
and display a notice if the profiling module is not installed.
Also, the package description should include python2.3-profiler in Suggests.
greetings
Torsten
--
Torsten Marek <[EMAIL PROTECTED]>
ID: A244C858 -- FP: 1902 0002 5DFC 856B F146 894C 7CC5 451E A244 C858
Keyserver: subkeys.pgp.net
--- Magic.py 2005-02-14 15:34:17 +0100
+++ /usr/lib/python2.3/site-packages/IPython/Magic.py 2005-02-14 15:46:09 +0100
@@ -21,7 +21,11 @@
# Python standard modules
import __builtin__
-import os,sys,inspect,pydoc,re,tempfile,profile,pstats,shlex,pdb,bdb
+import os,sys,inspect,pydoc,re,tempfile,shlex,pdb,bdb
+try:
+ import profile,pstats
+except ImportError:
+ profile = pstats = None
from getopt import getopt
from pprint import pprint, pformat
from cStringIO import StringIO
@@ -161,7 +165,15 @@
self.options_table = {}
MAGIC_PREFIX = shell.name+'.magic_'
MAGIC_ESCAPE = shell.ESC_MAGIC
+ if profile is None:
+ self.magic_prun = self.profile_missing_notice
+
+ def profile_missing_notice(self, *args, **kwargs):
+ print """The profile has been removed from the standard Debian package because
+of its non-free license. To use profiling, please install "python2.3-profiler"
+from non-free."""
+
def default_option(self,fn,optstr):
"""Make an entry in the options_table for fn, with value optstr"""
@@ -975,6 +987,7 @@
print 'Automatic pdb calling has been turned',\
on_off(self.shell.InteractiveTB.call_pdb)
+
def magic_prun(self, parameter_s ='',user_mode=1,
opts=None,arg_lst=None,prog_ns=None):