* 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.repodb = pisi.repodb.init()
|
||||||
ctx.installdb = pisi.installdb.init()
|
ctx.installdb = pisi.installdb.init()
|
||||||
ctx.filesdb = pisi.files.FilesDB()
|
ctx.filesdb = pisi.files.FilesDB()
|
||||||
|
|
||||||
packagedb.init_db()
|
packagedb.init_db()
|
||||||
#TODO: sourcedb
|
pisi.sourcedb.init()
|
||||||
# import pisi.sourcedb
|
|
||||||
# pisi.sourcedb.init()
|
|
||||||
else:
|
else:
|
||||||
ctx.repodb = None
|
ctx.repodb = None
|
||||||
ctx.installdb = None
|
ctx.installdb = None
|
||||||
@@ -82,6 +79,7 @@ def finalize():
|
|||||||
ctx.filesdb.close()
|
ctx.filesdb.close()
|
||||||
|
|
||||||
packagedb.finalize_db()
|
packagedb.finalize_db()
|
||||||
|
pisi.sourcedb.finalize()
|
||||||
ctx.ui.debug('PISI API finalized')
|
ctx.ui.debug('PISI API finalized')
|
||||||
|
|
||||||
def list_upgradable():
|
def list_upgradable():
|
||||||
|
|||||||
+7
-1
@@ -36,7 +36,7 @@ class SourceDB(object):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.d = shelve.LockedDBShelf('source')
|
self.d = shelve.LockedDBShelf('source')
|
||||||
|
|
||||||
def __del__(self):
|
def close(self):
|
||||||
self.d.close()
|
self.d.close()
|
||||||
|
|
||||||
def has_source(self, name):
|
def has_source(self, name):
|
||||||
@@ -66,3 +66,9 @@ def init():
|
|||||||
sourcedb = SourceDB()
|
sourcedb = SourceDB()
|
||||||
return sourcedb
|
return sourcedb
|
||||||
|
|
||||||
|
def finalize():
|
||||||
|
global sourcedb
|
||||||
|
if sourcedb:
|
||||||
|
sourcedb.close()
|
||||||
|
sourcedb = None
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user