From-Import-Removal - not merged?
This commit is contained in:
@@ -24,7 +24,7 @@ _ = __trans.ugettext
|
|||||||
|
|
||||||
import pisi
|
import pisi
|
||||||
import pisi.context as ctx
|
import pisi.context as ctx
|
||||||
from pisi.util import join_path
|
import pisi.util
|
||||||
import pisi.version
|
import pisi.version
|
||||||
|
|
||||||
class Error(pisi.Error):
|
class Error(pisi.Error):
|
||||||
@@ -34,7 +34,7 @@ class Error(pisi.Error):
|
|||||||
# if write is given it knows it has write access
|
# if write is given it knows it has write access
|
||||||
# if force is given it updates the specified db version
|
# if force is given it updates the specified db version
|
||||||
def check_dbversion(versionfile, ver, write=False, update=False):
|
def check_dbversion(versionfile, ver, write=False, update=False):
|
||||||
verfn = join_path(pisi.context.config.db_dir(), versionfile)
|
verfn = pisi.util.join_path(pisi.context.config.db_dir(), versionfile)
|
||||||
firsttime = False
|
firsttime = False
|
||||||
if os.path.exists(verfn):
|
if os.path.exists(verfn):
|
||||||
verfile = file(verfn, 'r')
|
verfile = file(verfn, 'r')
|
||||||
@@ -63,7 +63,7 @@ def check_dbversion(versionfile, ver, write=False, update=False):
|
|||||||
raise Error(_('Database version %s not present.') % versionfile)
|
raise Error(_('Database version %s not present.') % versionfile)
|
||||||
|
|
||||||
def lock_dbenv():
|
def lock_dbenv():
|
||||||
ctx.dbenv_lock = file(join_path(pisi.context.config.db_dir(), 'dbenv.lock'), 'w')
|
ctx.dbenv_lock = file(pisi.util.join_path(pisi.context.config.db_dir(), 'dbenv.lock'), 'w')
|
||||||
try:
|
try:
|
||||||
fcntl.flock(ctx.dbenv_lock, fcntl.LOCK_EX | fcntl.LOCK_NB)
|
fcntl.flock(ctx.dbenv_lock, fcntl.LOCK_EX | fcntl.LOCK_NB)
|
||||||
except IOError:
|
except IOError:
|
||||||
@@ -103,7 +103,7 @@ class LockedDBShelf(shelve.DBShelf):
|
|||||||
if dbenv == None:
|
if dbenv == None:
|
||||||
dbenv = ctx.dbenv
|
dbenv = ctx.dbenv
|
||||||
shelve.DBShelf.__init__(self, dbenv)
|
shelve.DBShelf.__init__(self, dbenv)
|
||||||
filename = join_path(pisi.context.config.db_dir(), dbname + '.bdb')
|
filename = pisi.util.join_path(pisi.context.config.db_dir(), dbname + '.bdb')
|
||||||
if dbenv and os.access(os.path.dirname(filename), os.W_OK):
|
if dbenv and os.access(os.path.dirname(filename), os.W_OK):
|
||||||
flags = 'w'
|
flags = 'w'
|
||||||
elif os.access(filename, os.R_OK):
|
elif os.access(filename, os.R_OK):
|
||||||
|
|||||||
Reference in New Issue
Block a user