it was not possible to finalize and than initialize later after importing the db modules.
make the globals in db modules None and leave the rest to python.
======================================================================
ERROR: testRemovePurge (installdbtests.InstallDBTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/baris/svn/uludag/trunk/pisi/tests/installdbtests.py", line 22, in setUp
pisi.api.init(database = True, comar = False)
File "/usr/lib/python2.3/site-packages/pisi/api.py", line 66, in init
ctx.filesdb = pisi.files.FilesDB()
File "/usr/lib/python2.3/site-packages/pisi/files.py", line 109, in __init__
shelve.LockedDBShelf.__init__(self, 'files')
File "/usr/lib/python2.3/site-packages/pisi/lockeddbshelve.py", line 43, in __init__
self.open(filename, dbname, filetype, flags, mode)
File "/usr/lib/python2.3/site-packages/pisi/lockeddbshelve.py", line 70, in open
self.lock()
File "/usr/lib/python2.3/site-packages/pisi/lockeddbshelve.py", line 78, in lock
raise Error(_("Another instance of PISI is running. Try later!"))
Error: PISI bir yerde daha çalışıyor. Yine deneyin!
This commit is contained in:
@@ -182,4 +182,5 @@ def finalize():
|
||||
global db
|
||||
if db:
|
||||
db.close()
|
||||
db = None
|
||||
|
||||
|
||||
+21
-10
@@ -143,17 +143,28 @@ def remove_package(name):
|
||||
|
||||
thirdparty_packagedb = inst_packagedb = None
|
||||
|
||||
def init_db():
|
||||
if not pisi.packagedb.thirdparty_packagedb:
|
||||
pisi.packagedb.thirdparty_packagedb = PackageDB('thirdparty')
|
||||
def init_db():
|
||||
global thirdparty_packagedb
|
||||
global inst_packagedb
|
||||
|
||||
if not thirdparty_packagedb:
|
||||
thirdparty_packagedb = PackageDB('thirdparty')
|
||||
if not pisi.packagedb.inst_packagedb:
|
||||
pisi.packagedb.inst_packagedb = PackageDB('installed')
|
||||
inst_packagedb = PackageDB('installed')
|
||||
|
||||
def finalize_db():
|
||||
if pisi.packagedb.thirdparty_packagedb:
|
||||
pisi.packagedb.thirdparty_packagedb.close()
|
||||
if pisi.packagedb.inst_packagedb:
|
||||
pisi.packagedb.inst_packagedb.close()
|
||||
if pisi.packagedb.packagedbs:
|
||||
del pisi.packagedb.packagedbs
|
||||
global thirdparty_packagedb
|
||||
global inst_packagedb
|
||||
global packagedbs
|
||||
|
||||
if thirdparty_packagedb:
|
||||
thirdparty_packagedb.close()
|
||||
thirdparty_packagedb = None
|
||||
|
||||
if inst_packagedb:
|
||||
inst_packagedb.close()
|
||||
inst_packagedb = None
|
||||
|
||||
if packagedbs:
|
||||
del packagedbs
|
||||
|
||||
|
||||
+10
-6
@@ -103,16 +103,20 @@ class RepoDB(object):
|
||||
db = None
|
||||
|
||||
def init():
|
||||
if pisi.repodb.db:
|
||||
return pisi.repodb.db
|
||||
global db
|
||||
|
||||
pisi.repodb.db = RepoDB()
|
||||
pisi.repodb.db.init_dbs()
|
||||
return pisi.repodb.db
|
||||
if db:
|
||||
return db
|
||||
|
||||
db = RepoDB()
|
||||
db.init_dbs()
|
||||
return db
|
||||
|
||||
def finalize():
|
||||
global db
|
||||
if pisi.repodb.db:
|
||||
|
||||
if db:
|
||||
db.close()
|
||||
db = None
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user