[shpy-commit] r10132 - in shpy/trunk/dist: . shpy/net shpy/ui_pygame

hpk at codespeak.net hpk at codespeak.net
Wed Mar 23 19:43:24 MET 2005


Author: hpk
Date: Wed Mar 23 19:43:24 2005
New Revision: 10132

Modified:
   shpy/trunk/dist/   (props changed)
   shpy/trunk/dist/shpy/net/gateway.py
   shpy/trunk/dist/shpy/net/register.py
   shpy/trunk/dist/shpy/ui_pygame/ui_pygame.py
   shpy/trunk/dist/startserver.py
Log:
just years later: shpy runs again! (kind of) 


Modified: shpy/trunk/dist/shpy/net/gateway.py
==============================================================================
--- shpy/trunk/dist/shpy/net/gateway.py	(original)
+++ shpy/trunk/dist/shpy/net/gateway.py	Wed Mar 23 19:43:24 2005
@@ -1,5 +1,6 @@
 import threading, struct, Queue, select, StringIO, socket
 import thread, time
+import py
 
 class Gateway:
     def __init__(self, io, ns = None):
@@ -110,18 +111,13 @@
             import autopath
         except ImportError:
             pass
-        try:
-            from unittest2.tool.dyncode import makecode
-        except ImportError:
-            print "please give me *some* way to access dyncode"
-            raise
         while 1:
             source = self.queue.get()
             if source is None:
                 break
             try:
                 print "executing source", source[:50]
-                co = makecode(source)
+                co = py.code.Source(source).compile() 
                 exec co in globals(), self.gateway.ns
             except:
                 import traceback, sys

Modified: shpy/trunk/dist/shpy/net/register.py
==============================================================================
--- shpy/trunk/dist/shpy/net/register.py	(original)
+++ shpy/trunk/dist/shpy/net/register.py	Wed Mar 23 19:43:24 2005
@@ -2,14 +2,13 @@
 import autopath, os
 import inspect, socket, thread
 from shpy.net import gateway, inputoutput
-from unittest2.tool import dyncode
-dyncode.installhacks()
+import py
+py.magic.invoke(compile=1)
 
 class InstallableGateway(gateway.Gateway):
     def __init__(self, addr, ns = None):
         io = inputoutput.connect(addr)
-        source = [inspect.getsource(dyncode),
-                  'installhacks()',
+        source = [
                   inspect.getsource(gateway),
                   inspect.getsource(inputoutput),
                   'directionflag = "<"',
@@ -63,6 +62,7 @@
         
         self.exec_remote('''
             import sys, StringIO
+            import py
             try:
                 execns
             except:
@@ -72,7 +72,7 @@
                 buffer = StringIO.StringIO()
                 sys.stdout = sys.stderr = buffer
                 try:
-                    exec makecode(%(sourcecode)r, 'single') in execns
+                    exec py.code.Source(%(sourcecode)r).compile(mode='single') in execns 
                 except:
                     import traceback
                     traceback.print_exc()

Modified: shpy/trunk/dist/shpy/ui_pygame/ui_pygame.py
==============================================================================
--- shpy/trunk/dist/shpy/ui_pygame/ui_pygame.py	(original)
+++ shpy/trunk/dist/shpy/ui_pygame/ui_pygame.py	Wed Mar 23 19:43:24 2005
@@ -6,6 +6,7 @@
 import shpy.net.register
 from shpy import info
 from shpy.ui_pygame import decorate
+import py
 
 RESOLUTION = (768, 512)
 #RESOLUTION = (300, 300)
@@ -13,7 +14,7 @@
 #HEIGHT = 24
 #ANTIALIAS = 1
 
-FONT = 'VeraMoBd.ttf'
+FONT = str(py.magic.autopath().dirpath('VeraMoBd.ttf'))
 HEIGHT = 12
 ANTIALIAS = 0
 
@@ -400,7 +401,7 @@
     if len(sys.argv) > 2:
         execserver = sys.argv[2]
     else:
-        execserver = 'popen=xpython -u -c "exec input()"'
+        execserver = 'popen=python -u -c "exec input()"'
     t = Terminal(sharedserver, execserver)
     try:
         t.run()

Modified: shpy/trunk/dist/startserver.py
==============================================================================
--- shpy/trunk/dist/startserver.py	(original)
+++ shpy/trunk/dist/startserver.py	Wed Mar 23 19:43:24 2005
@@ -7,8 +7,8 @@
 # this part of the program only executes on the server side
 #
 
-from unittest2.tool import dyncode
-dyncode.installhacks()
+import py
+py.magic.invoke(compile=1) 
 
 progname = 'readline_exec_server-1.1'
 # starting the agent server
@@ -32,7 +32,7 @@
             clientfile.close()
             g = {'clientsock' : clientsock, 
                  'address' : address}
-            co = dyncode.makecode(eval(source))
+            co = py.code.Source(eval(source)).compile()
             exec co in g
         except KeyboardInterrupt:
             sys.exit(1)


More information about the shpy-commit mailing list