* sourcedb: fix init/finalize
This commit is contained in:
+2
-4
@@ -64,11 +64,8 @@ def init(database = True, options = None, ui = None, comar = True):
|
||||
ctx.repodb = pisi.repodb.init()
|
||||
ctx.installdb = pisi.installdb.init()
|
||||
ctx.filesdb = pisi.files.FilesDB()
|
||||
|
||||
packagedb.init_db()
|
||||
#TODO: sourcedb
|
||||
# import pisi.sourcedb
|
||||
# pisi.sourcedb.init()
|
||||
pisi.sourcedb.init()
|
||||
else:
|
||||
ctx.repodb = None
|
||||
ctx.installdb = None
|
||||
@@ -82,6 +79,7 @@ def finalize():
|
||||
ctx.filesdb.close()
|
||||
|
||||
packagedb.finalize_db()
|
||||
pisi.sourcedb.finalize()
|
||||
ctx.ui.debug('PISI API finalized')
|
||||
|
||||
def list_upgradable():
|
||||
|
||||
+8
-2
@@ -36,7 +36,7 @@ class SourceDB(object):
|
||||
def __init__(self):
|
||||
self.d = shelve.LockedDBShelf('source')
|
||||
|
||||
def __del__(self):
|
||||
def close(self):
|
||||
self.d.close()
|
||||
|
||||
def has_source(self, name):
|
||||
@@ -65,4 +65,10 @@ def init():
|
||||
|
||||
sourcedb = SourceDB()
|
||||
return sourcedb
|
||||
|
||||
|
||||
def finalize():
|
||||
global sourcedb
|
||||
if sourcedb:
|
||||
sourcedb.close()
|
||||
sourcedb = None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user