Commit d62a297c authored by Kirill Smelkov's avatar Kirill Smelkov

Require Zodbtools

After switching to ZODB >= 4 in the previous commit, we can safely
require zodbtools, because there is now no conflict in between
ZODB3/ZODB eggs.
parent 0802da2b
...@@ -25,6 +25,7 @@ from ZODB import DB ...@@ -25,6 +25,7 @@ from ZODB import DB
from ZODB import POSException from ZODB import POSException
from ZODB.utils import p64, u64 from ZODB.utils import p64, u64
from persistent import Persistent from persistent import Persistent
import zodbtools.util
from weakref import WeakSet from weakref import WeakSet
import gc import gc
...@@ -33,38 +34,8 @@ import pkg_resources ...@@ -33,38 +34,8 @@ import pkg_resources
# open db storage by uri # open db storage by uri
def dbstoropen(uri): def dbstoropen(uri):
# if we can - use zodbtools to open via zodburi
try:
import zodbtools.util
except ImportError:
return _dbstoropen(uri)
return zodbtools.util.storageFromURL(uri) return zodbtools.util.storageFromURL(uri)
# simplified fallback to open a storage by URI when zodbtools/zodburi are not available.
# ( they require ZODB, instead of ZODB3, and thus we cannot use
# them together with ZODB 3.10 which we still support )
def _dbstoropen(uri):
if uri.startswith('neo://'):
# XXX hacky, only 1 master supported
from neo.client.Storage import Storage
name, master = uri[6:].split('@', 1) # neo://db@master -> db, master
stor = Storage(master_nodes=master, name=name)
elif uri.startswith('zeo://'):
# XXX hacky
from ZEO.ClientStorage import ClientStorage
host, port = uri[6:].split(':',1) # zeo://host:port -> host, port
port = int(port)
stor = ClientStorage((host, port))
else:
stor = FileStorage(uri)
return stor
# open stor/db/connection and return root obj # open stor/db/connection and return root obj
def dbopen(uri): def dbopen(uri):
stor = dbstoropen(uri) stor = dbstoropen(uri)
......
...@@ -248,6 +248,7 @@ setup( ...@@ -248,6 +248,7 @@ setup(
'numpy', # BigArray + its children 'numpy', # BigArray + its children
'ZODB >= 4', # for ZBigFile / ZBigArray 'ZODB >= 4', # for ZBigFile / ZBigArray
'zodbtools >= 0.0.0.dev8', # lib.zodb.dbstoropen + ...
'pygolang >= 0.0.2', # defer, sync.WaitGroup, ... 'pygolang >= 0.0.2', # defer, sync.WaitGroup, ...
......
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