Hi, I'd rather see that linda stays in main. I have included a patch that makes the usage of the profiler optional.
Regards, Bastian -- ,''`. Bastian Kleineidam : :' : GnuPG Schl�ssel `. `' gpg --keyserver wwwkeys.pgp.net --recv-keys 32EC6F3E `-
--- /usr/bin/linda 2004-12-08 02:50:27.000000000 +0100
+++ linda 2005-02-10 16:48:40.000000000 +0100
@@ -34,7 +34,7 @@
gettext.textdomain('linda')
_ = gettext.gettext
try:
- import os, pwd, gettext, locale, linda, profile, pstats
+ import os, pwd, gettext, locale, linda, pstats
from linda import clparser, root
from linda.debug import dprint, vprint
from linda.checker import Checker, CheckerException
@@ -45,6 +45,12 @@
traceback.print_exc(file=sys.stdout)
sys.exit(6)
+try:
+ import profile
+ has_profile = True
+except ImportError:
+ has_profile = False
+
class Linda:
def __init__(self):
self.check_sanity()
@@ -87,9 +93,13 @@
try:
main = Linda()
if clparser['profiling']:
- profile.run('main.run()', '/tmp/linda.prof')
- p = pstats.Stats('/tmp/linda.prof')
- p.sort_stats('cumulative').print_stats(20)
+ if has_profile:
+ profile.run('main.run()', '/tmp/linda.prof')
+ p = pstats.Stats('/tmp/linda.prof')
+ p.sort_stats('cumulative').print_stats(20)
+ else:
+ print _("Not profiling, please install the python-profiler
package.")
+ main.run()
else:
main.run()
except KeyboardInterrupt:
signature.asc
Description: Digital signature

