From 4c38ff30ee426c1c6ceb4ea25a4a93751589c24d Mon Sep 17 00:00:00 2001 From: hpk Date: Tue, 2 Sep 2008 14:42:35 +0200 Subject: [PATCH] [svn r57756] * create new contrib directory * move py/green to contrib/pygreen, fix tests and code to pass --HG-- branch : trunk --- {py/green => contrib/pygreen}/__init__.py | 0 {py/green => contrib/pygreen}/conftest.py | 2 +- {py/green => contrib/pygreen}/greenexecnet.py | 10 +++++----- {py/green => contrib/pygreen}/greensock2.py | 0 {py/green => contrib/pygreen}/msgstruct.py | 0 {py/green => contrib/pygreen}/pipe/__init__.py | 0 {py/green => contrib/pygreen}/pipe/common.py | 2 +- {py/green => contrib/pygreen}/pipe/fd.py | 2 +- {py/green => contrib/pygreen}/pipe/gsocket.py | 2 +- {py/green => contrib/pygreen}/pipe/mp.py | 2 +- {py/green => contrib/pygreen}/pipelayer.py | 0 {py/green => contrib/pygreen}/server/__init__.py | 0 {py/green => contrib/pygreen}/server/httpserver.py | 0 {py/green => contrib/pygreen}/test/__init__.py | 0 .../pygreen}/test/test_greenexecnet.py | 9 +++++++-- {py/green => contrib/pygreen}/test/test_greensock2.py | 2 +- {py/green => contrib/pygreen}/test/test_pipelayer.py | 2 +- contrib/readme.txt | 2 ++ 18 files changed, 21 insertions(+), 14 deletions(-) rename {py/green => contrib/pygreen}/__init__.py (100%) rename {py/green => contrib/pygreen}/conftest.py (78%) rename {py/green => contrib/pygreen}/greenexecnet.py (96%) rename {py/green => contrib/pygreen}/greensock2.py (100%) rename {py/green => contrib/pygreen}/msgstruct.py (100%) rename {py/green => contrib/pygreen}/pipe/__init__.py (100%) rename {py/green => contrib/pygreen}/pipe/common.py (96%) rename {py/green => contrib/pygreen}/pipe/fd.py (98%) rename {py/green => contrib/pygreen}/pipe/gsocket.py (98%) rename {py/green => contrib/pygreen}/pipe/mp.py (91%) rename {py/green => contrib/pygreen}/pipelayer.py (100%) rename {py/green => contrib/pygreen}/server/__init__.py (100%) rename {py/green => contrib/pygreen}/server/httpserver.py (100%) rename {py/green => contrib/pygreen}/test/__init__.py (100%) rename {py/green => contrib/pygreen}/test/test_greenexecnet.py (76%) rename {py/green => contrib/pygreen}/test/test_greensock2.py (99%) rename {py/green => contrib/pygreen}/test/test_pipelayer.py (98%) create mode 100644 contrib/readme.txt diff --git a/py/green/__init__.py b/contrib/pygreen/__init__.py similarity index 100% rename from py/green/__init__.py rename to contrib/pygreen/__init__.py diff --git a/py/green/conftest.py b/contrib/pygreen/conftest.py similarity index 78% rename from py/green/conftest.py rename to contrib/pygreen/conftest.py index 63e5718f1..8e89c9d06 100644 --- a/py/green/conftest.py +++ b/contrib/pygreen/conftest.py @@ -5,4 +5,4 @@ class Directory(py.test.collect.Directory): if os.name == 'nt': py.test.skip("Cannot test green layer on windows") else: - return super(Directory, self).run() + return super(Directory, self).collect() diff --git a/py/green/greenexecnet.py b/contrib/pygreen/greenexecnet.py similarity index 96% rename from py/green/greenexecnet.py rename to contrib/pygreen/greenexecnet.py index 93ef52fa9..17c72fa47 100644 --- a/py/green/greenexecnet.py +++ b/contrib/pygreen/greenexecnet.py @@ -13,8 +13,8 @@ There are some features lacking, most notable: """ import sys, os, py, inspect -from py.__.green import greensock2 -from py.__.green.msgstruct import message, decodemessage +from pygreen import greensock2 +from pygreen.msgstruct import message, decodemessage MSG_REMOTE_EXEC = 'r' MSG_OBJECT = 'o' @@ -163,7 +163,7 @@ class PopenCmdGateway(Gateway): action = "exec input()" 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) fdin = FDInput(child_out.fileno(), child_out.close) fdout = FDOutput(child_in.fileno(), child_in.close) @@ -173,14 +173,14 @@ class PopenCmdGateway(Gateway): def get_bootstrap_code(): # XXX assumes that the py lib is installed on the remote side src = [] - src.append('from py.__.green import greenexecnet') + src.append('from pygreen import greenexecnet') src.append('greenexecnet.PopenCmdGateway.run_server()') src.append('') return '%r\n' % ('\n'.join(src),) get_bootstrap_code = staticmethod(get_bootstrap_code) 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)), output = FDOutput(os.dup(1)), is_remote = True) diff --git a/py/green/greensock2.py b/contrib/pygreen/greensock2.py similarity index 100% rename from py/green/greensock2.py rename to contrib/pygreen/greensock2.py diff --git a/py/green/msgstruct.py b/contrib/pygreen/msgstruct.py similarity index 100% rename from py/green/msgstruct.py rename to contrib/pygreen/msgstruct.py diff --git a/py/green/pipe/__init__.py b/contrib/pygreen/pipe/__init__.py similarity index 100% rename from py/green/pipe/__init__.py rename to contrib/pygreen/pipe/__init__.py diff --git a/py/green/pipe/common.py b/contrib/pygreen/pipe/common.py similarity index 96% rename from py/green/pipe/common.py rename to contrib/pygreen/pipe/common.py index 975b60be3..521c95752 100644 --- a/py/green/pipe/common.py +++ b/contrib/pygreen/pipe/common.py @@ -1,4 +1,4 @@ -from py.__.green import greensock2 +from pygreen import greensock2 VERBOSE = True diff --git a/py/green/pipe/fd.py b/contrib/pygreen/pipe/fd.py similarity index 98% rename from py/green/pipe/fd.py rename to contrib/pygreen/pipe/fd.py index 0a3154436..14f630443 100644 --- a/py/green/pipe/fd.py +++ b/contrib/pygreen/pipe/fd.py @@ -1,5 +1,5 @@ import os -from py.__.green import greensock2 +from pygreen import greensock2 class FDInput(object): diff --git a/py/green/pipe/gsocket.py b/contrib/pygreen/pipe/gsocket.py similarity index 98% rename from py/green/pipe/gsocket.py rename to contrib/pygreen/pipe/gsocket.py index aa807d3f2..2d48eb198 100644 --- a/py/green/pipe/gsocket.py +++ b/contrib/pygreen/pipe/gsocket.py @@ -1,4 +1,4 @@ -from py.__.green import greensock2 +from pygreen import greensock2 import socket, errno, os error = socket.error diff --git a/py/green/pipe/mp.py b/contrib/pygreen/pipe/mp.py similarity index 91% rename from py/green/pipe/mp.py rename to contrib/pygreen/pipe/mp.py index b03551a1e..d7e95e6a4 100644 --- a/py/green/pipe/mp.py +++ b/contrib/pygreen/pipe/mp.py @@ -1,4 +1,4 @@ -from py.__.green.pipe.common import BufferedInput +from pygreen.pipe.common import BufferedInput class MeetingPointInput(BufferedInput): diff --git a/py/green/pipelayer.py b/contrib/pygreen/pipelayer.py similarity index 100% rename from py/green/pipelayer.py rename to contrib/pygreen/pipelayer.py diff --git a/py/green/server/__init__.py b/contrib/pygreen/server/__init__.py similarity index 100% rename from py/green/server/__init__.py rename to contrib/pygreen/server/__init__.py diff --git a/py/green/server/httpserver.py b/contrib/pygreen/server/httpserver.py similarity index 100% rename from py/green/server/httpserver.py rename to contrib/pygreen/server/httpserver.py diff --git a/py/green/test/__init__.py b/contrib/pygreen/test/__init__.py similarity index 100% rename from py/green/test/__init__.py rename to contrib/pygreen/test/__init__.py diff --git a/py/green/test/test_greenexecnet.py b/contrib/pygreen/test/test_greenexecnet.py similarity index 76% rename from py/green/test/test_greenexecnet.py rename to contrib/pygreen/test/test_greenexecnet.py index 3b23b314c..b378d193a 100644 --- a/py/green/test/test_greenexecnet.py +++ b/contrib/pygreen/test/test_greenexecnet.py @@ -1,7 +1,12 @@ 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(): gw = PopenGateway() diff --git a/py/green/test/test_greensock2.py b/contrib/pygreen/test/test_greensock2.py similarity index 99% rename from py/green/test/test_greensock2.py rename to contrib/pygreen/test/test_greensock2.py index d1b610e6a..1d48799aa 100644 --- a/py/green/test/test_greensock2.py +++ b/contrib/pygreen/test/test_greensock2.py @@ -1,6 +1,6 @@ import py from socket import * -from py.__.green.greensock2 import * +from pygreen.greensock2 import * def test_meetingpoint(): giv1, acc1 = meetingpoint() diff --git a/py/green/test/test_pipelayer.py b/contrib/pygreen/test/test_pipelayer.py similarity index 98% rename from py/green/test/test_pipelayer.py rename to contrib/pygreen/test/test_pipelayer.py index 76b53a200..de987ecdb 100644 --- a/py/green/test/test_pipelayer.py +++ b/contrib/pygreen/test/test_pipelayer.py @@ -1,5 +1,5 @@ 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(): data1 = os.urandom(1000) diff --git a/contrib/readme.txt b/contrib/readme.txt new file mode 100644 index 000000000..26ac5f9af --- /dev/null +++ b/contrib/readme.txt @@ -0,0 +1,2 @@ + +pygreen: experimental IO and execnet operations through greenlets