[pypy-svn] r45015 - in pypy/dist/dotviewer: . test
fijal at codespeak.net
fijal at codespeak.net
Fri Jul 13 14:31:14 CEST 2007
Author: fijal
Date: Fri Jul 13 14:31:14 2007
New Revision: 45015
Modified:
pypy/dist/dotviewer/graphclient.py
pypy/dist/dotviewer/graphpage.py
pypy/dist/dotviewer/graphparse.py
pypy/dist/dotviewer/test/test_interactive.py
Log:
Make it run on top of pypy-c (well, not really...)
Modified: pypy/dist/dotviewer/graphclient.py
==============================================================================
--- pypy/dist/dotviewer/graphclient.py (original)
+++ pypy/dist/dotviewer/graphclient.py Fri Jul 13 14:31:14 2007
@@ -125,7 +125,11 @@
return msgstruct.SocketIO(s)
def spawn_local_handler():
- cmdline = '"%s" -u "%s" --stdio' % (sys.executable, GRAPHSERVER)
+ if hasattr(sys, 'pypy_objspaceclass'):
+ python = 'python'
+ else:
+ python = sys.executable
+ cmdline = '"%s" -u "%s" --stdio' % (python, GRAPHSERVER)
child_in, child_out = os.popen2(cmdline, 'tb', 0)
io = msgstruct.FileIO(child_out, child_in)
return io
Modified: pypy/dist/dotviewer/graphpage.py
==============================================================================
--- pypy/dist/dotviewer/graphpage.py (original)
+++ pypy/dist/dotviewer/graphpage.py Fri Jul 13 14:31:14 2007
@@ -35,9 +35,11 @@
def display_background(self):
"Display a graph page in a background thread."
- import thread
- thread.start_new_thread(self.display, ())
-
+ try:
+ import thread
+ thread.start_new_thread(self.display, ())
+ except ImportError:
+ self.display()
class DotFileGraphPage(GraphPage):
def compute(self, dotfile):
Modified: pypy/dist/dotviewer/graphparse.py
==============================================================================
--- pypy/dist/dotviewer/graphparse.py (original)
+++ pypy/dist/dotviewer/graphparse.py Fri Jul 13 14:31:14 2007
@@ -2,7 +2,7 @@
Graph file parsing.
"""
-import os, sys, re, thread
+import os, sys, re
import msgstruct
re_nonword = re.compile(r'([^0-9a-zA-Z_.]+)')
@@ -46,7 +46,12 @@
cmdline = 'neato -Tplain'
#print >> sys.stderr, '* running:', cmdline
child_in, child_out = os.popen2(cmdline, 'r')
- thread.start_new_thread(bkgndwrite, (child_in, content))
+ try:
+ import thread
+ except ImportError:
+ bkgndwrite(child_in, content)
+ else:
+ thread.start_new_thread(bkgndwrite, (child_in, content))
plaincontent = child_out.read()
child_out.close()
if not plaincontent: # 'dot' is likely not installed
Modified: pypy/dist/dotviewer/test/test_interactive.py
==============================================================================
--- pypy/dist/dotviewer/test/test_interactive.py (original)
+++ pypy/dist/dotviewer/test/test_interactive.py Fri Jul 13 14:31:14 2007
@@ -122,7 +122,12 @@
host, port = s.getsockname() # pick a random free port
s.close()
- cmdargs = [sys.executable, str(pkgdir.join('graphserver.py')),
+ if hasattr(sys, 'pypy_objspaceclass'):
+ python = 'python'
+ else:
+ python = sys.executable
+
+ cmdargs = [python, str(pkgdir.join('graphserver.py')),
str(port)]
print '* starting:', ' '.join(cmdargs)
pid = os.spawnv(os.P_NOWAIT, cmdargs[0], cmdargs)
More information about the Pypy-commit
mailing list