Commit 2b226477 authored by Jim Fulton's avatar Jim Fulton

Changed the way we try to find ZServer to take advantage of the known

location of the start.py script (when it is used).
parent b182ce7b
...@@ -83,4 +83,5 @@ ...@@ -83,4 +83,5 @@
# #
############################################################################## ##############################################################################
import fap # fixup asyncore/cPickle dependencies import fap
fap.fap() # fixup asyncore/cPickle dependencies
...@@ -90,47 +90,54 @@ localizing the hacks^H^H^H^H^Hchanges here. ...@@ -90,47 +90,54 @@ localizing the hacks^H^H^H^H^Hchanges here.
""" """
import sys import sys
# if we are using an old version of Python, our asyncore is likely to def whiff(where):
# be out of date. If ZServer is sitting around, we can get a current if not where: return 0
# version of ayncore from it. In any case, if we are going to be used
# with Zope, it's important to use the version from Zope.
try:
from ZServer.medusa import asyncore
except:
# Try a little harder to import ZServer
import os, imp import os, imp
try: m=imp.find_module('ZServer', ['.']) try: m=imp.find_module('ZServer', [where])
except: except: return 0
try: m=imp.find_module('ZServer', [os.path.join('..','..')]) else: return 1
except:
import asyncore
else: def fap(where=''):
sys.path.append(os.path.join('..','..')) # if we are using an old version of Python, our asyncore is likely to
from ZServer.medusa import asyncore # be out of date. If ZServer is sitting around, we can get a current
else: # version of ayncore from it. In any case, if we are going to be used
sys.path.append('.') # with Zope, it's important to use the version from Zope.
try:
from ZServer.medusa import asyncore from ZServer.medusa import asyncore
except:
# Try a little harder to import ZServer
import os, imp
if sys.version[:1] < '2' and asyncore.loop.func_code.co_argcount < 3: for location in where, '.', os.path.join('..','..'):
raise ImportError, 'Cannot import an up-to-date asyncore' if whiff(location):
sys.path.append(location)
try:
from ZServer.medusa import asyncore
except:
import asyncore
break
sys.modules['ZEO.asyncore']=asyncore if sys.version[:1] < '2' and asyncore.loop.func_code.co_argcount < 3:
raise ImportError, 'Cannot import an up-to-date asyncore'
# We need a recent version of cPickle too. sys.modules['ZEO.asyncore']=asyncore
if sys.version[:3] < '1.6':
try: # We need a recent version of cPickle too.
from ZODB import cPickle if sys.version[:3] < '1.6':
sys.modules['ZEO.cPickle']=cPickle try:
except: from ZODB import cPickle
# Try a little harder sys.modules['ZEO.cPickle']=cPickle
except:
# Try a little harder
import cPickle
else:
import cPickle import cPickle
else:
import cPickle
import cStringIO import cStringIO
p=cPickle.Pickler(cStringIO.StringIO(),1) p=cPickle.Pickler(cStringIO.StringIO(),1)
try: try:
p.fast=1 p.fast=1
except: except:
raise ImportError, 'Cannot import an up-to-date cPickle' raise ImportError, 'Cannot import an up-to-date cPickle'
...@@ -86,7 +86,7 @@ ...@@ -86,7 +86,7 @@
"""Start the server storage. """Start the server storage.
""" """
__version__ = "$Revision: 1.18 $"[11:-2] __version__ = "$Revision: 1.19 $"[11:-2]
import sys, os, getopt, string import sys, os, getopt, string
...@@ -207,7 +207,8 @@ def main(argv): ...@@ -207,7 +207,8 @@ def main(argv):
elif o=='-d': detailed=1 elif o=='-d': detailed=1
elif o=='-s': Z=0 elif o=='-s': Z=0
import fap # fixup asyncore/cPickle dependencies import fap
fap.fap(directory(me, 4)) # fixup asyncore/cPickle dependencies
if port is None and unix is None: if port is None and unix is None:
print usage print usage
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment