Fixed broken saranwrap test by exposing the importerror to the parent process; a better overall design. Fixed some mistakes in the poll module. Slightly loosened sqlite3 dependency so pysqlite2 is a substitute.

This commit is contained in:
Ryan Williams
2009-08-07 00:18:16 -07:00
parent 583020955d
commit 0245630a87
5 changed files with 24 additions and 11 deletions

View File

@@ -50,7 +50,7 @@ class Hub(hub.BaseHub):
if not oldreader:
# Only need to re-register this fileno if the mask changes
mask = self.get_fn_mask(oldreader, self.writers.get(fileno))
mask = self.get_fn_mask(read_cb, self.writers.get(fileno))
self.poll.register(fileno, mask)
def add_writer(self, fileno, write_cb):
@@ -61,12 +61,12 @@ class Hub(hub.BaseHub):
The *write_cb* argument is the callback which will be called when the file
is ready for writing.
"""
oldwriter = self.writer.get(fileno)
oldwriter = self.writers.get(fileno)
super(Hub, self).add_writer(fileno, write_cb)
if not oldwriter:
# Only need to re-register this fileno if the mask changes
mask = self.get_fn_mask(oldwriter, self.readers.get(fileno))
mask = self.get_fn_mask(self.readers.get(fileno), write_cb)
self.poll.register(fileno, mask)
def get_fn_mask(self, read, write):

View File

@@ -532,7 +532,7 @@ when the id is None."""
pass
if obj is None or id is None:
id = None
obj = self._export
obj = self._export()
#_log("found object %s" % str(obj))
# Handle the request via a method with a special name on the server
@@ -639,15 +639,23 @@ def main():
_g_logfile = open(options.logfile, 'a')
from eventlet import tpool
base_obj = [None]
if options.module:
export = api.named(options.module)
def get_module():
if base_obj[0] is None:
base_obj[0] = api.named(options.module)
return base_obj[0]
server = Server(tpool.Proxy(sys.stdin),
tpool.Proxy(sys.stdout),
export)
get_module)
elif options.child:
def get_base():
if base_obj[0] is None:
base_obj[0] = {}
return base_obj[0]
server = Server(tpool.Proxy(sys.stdin),
tpool.Proxy(sys.stdout),
{})
get_base)
# *HACK: some modules may emit on stderr, which breaks everything.
class NullSTDOut(object):

View File

@@ -22,7 +22,10 @@
import sys
import os
import sqlite3
try:
import sqlite3
except ImportError:
import pysqlite2.dbapi2 as sqlite3
import glob
REPO_URL = 'http://bitbucket.org/denis/eventlet'

View File

@@ -23,7 +23,10 @@
import sys
import os
import traceback
import sqlite3
try:
import sqlite3
except ImportError:
import pysqlite2.dbapi2 as sqlite3
import re
import glob

View File

@@ -270,11 +270,10 @@ sys_path = sys.path""")
# this should fail because we haven't stuck the temp_dir in our path yet
prox = saranwrap.wrap_module('jitar_hero')
import cPickle
try:
prox.pypath
self.fail()
except cPickle.UnpicklingError:
except ImportError:
pass
# now try to saranwrap it