[Epydoc-commits] SF.net SVN: epydoc: [1627] trunk/epydoc/src/epydoc/cli.py
Brought to you by:
edloper
From: <ed...@us...> - 2007-09-24 00:48:16
|
Revision: 1627 http://epydoc.svn.sourceforge.net/epydoc/?rev=1627&view=rev Author: edloper Date: 2007-09-23 17:48:14 -0700 (Sun, 23 Sep 2007) Log Message: ----------- - Use cProfiler, if it's available, for --profile-epydoc Modified Paths: -------------- trunk/epydoc/src/epydoc/cli.py Modified: trunk/epydoc/src/epydoc/cli.py =================================================================== --- trunk/epydoc/src/epydoc/cli.py 2007-09-24 00:33:58 UTC (rev 1626) +++ trunk/epydoc/src/epydoc/cli.py 2007-09-24 00:48:14 UTC (rev 1627) @@ -86,7 +86,7 @@ GRAPH_TYPES = ('classtree', 'callgraph', 'umlclasstree') ACTIONS = ('html', 'text', 'latex', 'dvi', 'ps', 'pdf', 'check') DEFAULT_DOCFORMAT = 'epytext' -PROFILER = 'hotshot' #: Which profiler to use: 'hotshot' or 'profile' +PROFILER = 'profile' #: Which profiler to use: 'hotshot' or 'profile' ###################################################################### #{ Help Topics @@ -992,16 +992,21 @@ # Standard 'profile' profiler. elif PROFILER == 'profile': - try: from profile import Profile + # cProfile module was added in Python 2.5 -- use it if its' + # available, since it's faster. + try: from cProfile import Profile except ImportError: - print >>sys.stderr, "Could not import profile module!" - return + try: from profile import Profile + except ImportError: + print >>sys.stderr, "Could not import profile module!" + return # There was a bug in Python 2.4's profiler. Check if it's # present, and if so, fix it. (Bug was fixed in 2.4maint: # <http://mail.python.org/pipermail/python-checkins/ # 2005-September/047099.html>) - if (Profile.dispatch['c_exception'] is + if (hasattr(Profile, 'dispatch') and + Profile.dispatch['c_exception'] is Profile.trace_dispatch_exception.im_func): trace_dispatch_return = Profile.trace_dispatch_return.im_func Profile.dispatch['c_exception'] = trace_dispatch_return This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |