[pypy-svn] r44263 - in pypy/branch/graphserver-dist: dotviewer pypy/translator/goal pypy/translator/tool
arigo at codespeak.net
arigo at codespeak.net
Fri Jun 15 10:07:18 CEST 2007
Author: arigo
Date: Fri Jun 15 10:07:18 2007
New Revision: 44263
Removed:
pypy/branch/graphserver-dist/pypy/translator/tool/graphserver.py
pypy/branch/graphserver-dist/pypy/translator/tool/port.py
Modified:
pypy/branch/graphserver-dist/dotviewer/graphparse.py
pypy/branch/graphserver-dist/pypy/translator/goal/translate.py
pypy/branch/graphserver-dist/pypy/translator/tool/pdbplus.py
Log:
Remove all the code that deals with running pygame in the correct thread.
Modified: pypy/branch/graphserver-dist/dotviewer/graphparse.py
==============================================================================
--- pypy/branch/graphserver-dist/dotviewer/graphparse.py (original)
+++ pypy/branch/graphserver-dist/dotviewer/graphparse.py Fri Jun 15 10:07:18 2007
@@ -19,7 +19,7 @@
cmdline = 'dot -Tplain'
else:
cmdline = 'neato -Tplain'
- print >> sys.stderr, '* running:', cmdline
+ #print >> sys.stderr, '* running:', cmdline
child_in, child_out = os.popen2(cmdline, 'r')
thread.start_new_thread(bkgndwrite, (child_in, content))
plaincontent = child_out.read()
Modified: pypy/branch/graphserver-dist/pypy/translator/goal/translate.py
==============================================================================
--- pypy/branch/graphserver-dist/pypy/translator/goal/translate.py (original)
+++ pypy/branch/graphserver-dist/pypy/translator/goal/translate.py Fri Jun 15 10:07:18 2007
@@ -44,9 +44,6 @@
return result
translate_optiondescr = OptionDescription("translate", "XXX", [
- IntOption("graphserve", """Serve analysis graphs on port number
-(see pypy/translator/tool/pygame/graphclient.py)""",
- cmdline="--graphserve"),
StrOption("targetspec", "XXX", default='targetpypystandalone',
cmdline=None),
BoolOption("profile",
@@ -211,27 +208,6 @@
t = translator.TranslationContext(config=config)
- class ServerSetup:
- async_server = None
-
- def __call__(self, port=None, async_only=False):
- try:
- t1 = drv.hint_translator
- except (NameError, AttributeError):
- t1 = t
- if self.async_server is not None:
- return self.async_server
- elif port is not None:
- from pypy.translator.tool.graphserver import run_async_server
- serv_start, serv_show, serv_stop = self.async_server = run_async_server(t1, translateconfig, port)
- return serv_start, serv_show, serv_stop
- elif not async_only:
- from pypy.translator.tool.graphserver import run_server_for_inprocess_client
- return run_server_for_inprocess_client(t1, translateconfig)
-
- server_setup = ServerSetup()
- server_setup(translateconfig.graphserve, async_only=True)
-
pdb_plus_show = PdbPlusShow(t) # need a translator to support extended commands
def debug(got_error):
@@ -263,7 +239,16 @@
log.event("start debugger...")
- pdb_plus_show.start(tb, server_setup, graphic=not translateconfig.text)
+ if not translateconfig.text:
+ try:
+ t1 = drv.hint_translator
+ except (NameError, AttributeError):
+ t1 = t
+ from pypy.translator.tool import graphpage
+ page = graphpage.TranslatorPage(t1, translateconfig.huge)
+ page.display_background()
+
+ pdb_plus_show.start(tb)
try:
drv = driver.TranslationDriver.from_targetspec(targetspec_dic, config, args,
Modified: pypy/branch/graphserver-dist/pypy/translator/tool/pdbplus.py
==============================================================================
--- pypy/branch/graphserver-dist/pypy/translator/tool/pdbplus.py (original)
+++ pypy/branch/graphserver-dist/pypy/translator/tool/pdbplus.py Fri Jun 15 10:07:18 2007
@@ -4,10 +4,6 @@
import sys
from pypy.objspace.flow.model import FunctionGraph
-class _EnableGraphic:
- def __init__(self, port=None):
- self.port = port
-
class NoTTY(Exception):
pass
@@ -33,16 +29,8 @@
def expose(self, d):
self.exposed.update(d)
- show = None
-
- def install_show(self, show):
- self.show = show
-
def _show(self, page):
- if not self.show:
- print "*** No display"
- return
- self.show(page)
+ page.display_background()
def _importobj(self, fullname):
obj = None
@@ -391,23 +379,6 @@
from pypy.translator.tool import graphpage
self._show(graphpage.ClassHierarchyPage(self.translator))
- def do_enable_graphic(self, arg):
- """enable_graphic
-enable pygame graph display even from non-graphic mode"""
- if self.show:
- print "*** display already there"
- return
- raise _EnableGraphic
-
- def do_graphserve(self, arg):
- """graphserve <port>
-start serving graphs on <port>
-"""
- if self.show:
- print "*** display already there"
- return
- raise _EnableGraphic(int(arg))
-
def do_interact(self, arg):
"""invoke a code.py sub prompt"""
ns = self.curframe.f_globals.copy()
@@ -425,7 +396,7 @@
print self.TRYPREFIXES
# start helpers
- def _run_debugger(self, tb):
+ def start(self, tb):
if tb is None:
fn, args = self.set_trace, ()
else:
@@ -439,37 +410,6 @@
except pdb.bdb.BdbQuit:
pass
- def _run_debugger_in_thread(self, tb, cleanup=None, cleanup_args=()):
- def _run_in_thread():
- try:
- self._run_debugger(tb)
- finally:
- if cleanup is not None:
- cleanup(*cleanup_args)
- import threading
- return threading.Thread(target=_run_in_thread, args=())
-
- def start(self, tb, server_setup, graphic=False):
- port = None
- if not graphic:
- try:
- self._run_debugger(tb)
- except _EnableGraphic, engraph:
- port = engraph.port
- else:
- return
- try:
- start, show, stop = server_setup(port)
- except Exception, e:
- print '%s.%s: %s' % (e.__class__.__module__,
- e.__class__.__name__, e)
- return self.start(tb, server_setup, graphic=False)
- self.install_show(show)
- debugger = self._run_debugger_in_thread(tb, stop)
- debugger.start()
- start()
- debugger.join()
-
def pdbcatch(f):
"A decorator that throws you in a pdbplus if the given function raises."
More information about the Pypy-commit
mailing list