[svn r57756] * create new contrib directory

* move py/green to contrib/pygreen,
  fix tests and code to pass

--HG--
branch : trunk
This commit is contained in:
hpk 2008-09-02 14:42:35 +02:00
parent 9f81afdd97
commit 4c38ff30ee
18 changed files with 21 additions and 14 deletions

View File

@ -5,4 +5,4 @@ class Directory(py.test.collect.Directory):
if os.name == 'nt': if os.name == 'nt':
py.test.skip("Cannot test green layer on windows") py.test.skip("Cannot test green layer on windows")
else: else:
return super(Directory, self).run() return super(Directory, self).collect()

View File

@ -13,8 +13,8 @@ There are some features lacking, most notable:
""" """
import sys, os, py, inspect import sys, os, py, inspect
from py.__.green import greensock2 from pygreen import greensock2
from py.__.green.msgstruct import message, decodemessage from pygreen.msgstruct import message, decodemessage
MSG_REMOTE_EXEC = 'r' MSG_REMOTE_EXEC = 'r'
MSG_OBJECT = 'o' MSG_OBJECT = 'o'
@ -163,7 +163,7 @@ class PopenCmdGateway(Gateway):
action = "exec input()" action = "exec input()"
def __init__(self, cmdline): def __init__(self, cmdline):
from py.__.green.pipe.fd import FDInput, FDOutput from pygreen.pipe.fd import FDInput, FDOutput
child_in, child_out = os.popen2(cmdline, 't', 0) child_in, child_out = os.popen2(cmdline, 't', 0)
fdin = FDInput(child_out.fileno(), child_out.close) fdin = FDInput(child_out.fileno(), child_out.close)
fdout = FDOutput(child_in.fileno(), child_in.close) fdout = FDOutput(child_in.fileno(), child_in.close)
@ -173,14 +173,14 @@ class PopenCmdGateway(Gateway):
def get_bootstrap_code(): def get_bootstrap_code():
# XXX assumes that the py lib is installed on the remote side # XXX assumes that the py lib is installed on the remote side
src = [] src = []
src.append('from py.__.green import greenexecnet') src.append('from pygreen import greenexecnet')
src.append('greenexecnet.PopenCmdGateway.run_server()') src.append('greenexecnet.PopenCmdGateway.run_server()')
src.append('') src.append('')
return '%r\n' % ('\n'.join(src),) return '%r\n' % ('\n'.join(src),)
get_bootstrap_code = staticmethod(get_bootstrap_code) get_bootstrap_code = staticmethod(get_bootstrap_code)
def run_server(): def run_server():
from py.__.green.pipe.fd import FDInput, FDOutput from pygreen.pipe.fd import FDInput, FDOutput
gw = Gateway(input = FDInput(os.dup(0)), gw = Gateway(input = FDInput(os.dup(0)),
output = FDOutput(os.dup(1)), output = FDOutput(os.dup(1)),
is_remote = True) is_remote = True)

View File

@ -1,4 +1,4 @@
from py.__.green import greensock2 from pygreen import greensock2
VERBOSE = True VERBOSE = True

View File

@ -1,5 +1,5 @@
import os import os
from py.__.green import greensock2 from pygreen import greensock2
class FDInput(object): class FDInput(object):

View File

@ -1,4 +1,4 @@
from py.__.green import greensock2 from pygreen import greensock2
import socket, errno, os import socket, errno, os
error = socket.error error = socket.error

View File

@ -1,4 +1,4 @@
from py.__.green.pipe.common import BufferedInput from pygreen.pipe.common import BufferedInput
class MeetingPointInput(BufferedInput): class MeetingPointInput(BufferedInput):

View File

@ -1,7 +1,12 @@
import py import py
from py.__.green.greenexecnet import * from pygreen.greenexecnet import *
import pygreen
py.test.skip("Does not work with globally installed pylib") def setup_module(mod):
os.environ["PYTHONPATH"] = "%s:%s" %(
py.path.local(pygreen.__file__).dirpath().dirpath(), os.environ['PYTHONPATH'])
#py.test.skip("need to fix PYTHONPATH/sys.path handling for sub processes so "
# "that they find the pygreen package.")
def test_simple(): def test_simple():
gw = PopenGateway() gw = PopenGateway()

View File

@ -1,6 +1,6 @@
import py import py
from socket import * from socket import *
from py.__.green.greensock2 import * from pygreen.greensock2 import *
def test_meetingpoint(): def test_meetingpoint():
giv1, acc1 = meetingpoint() giv1, acc1 = meetingpoint()

View File

@ -1,5 +1,5 @@
import os, random import os, random
from py.__.green.pipelayer import PipeLayer, pipe_over_udp, PipeOverUdp from pygreen.pipelayer import PipeLayer, pipe_over_udp, PipeOverUdp
def test_simple(): def test_simple():
data1 = os.urandom(1000) data1 = os.urandom(1000)

2
contrib/readme.txt Normal file
View File

@ -0,0 +1,2 @@
pygreen: experimental IO and execnet operations through greenlets