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
|
global db
|
||||||
if db:
|
if db:
|
||||||
db.close()
|
db.close()
|
||||||
|
db = None
|
||||||
|
|
||||||
|
|||||||
+21
-10
@@ -143,17 +143,28 @@ def remove_package(name):
|
|||||||
|
|
||||||
thirdparty_packagedb = inst_packagedb = None
|
thirdparty_packagedb = inst_packagedb = None
|
||||||
|
|
||||||
def init_db():
|
def init_db():
|
||||||
if not pisi.packagedb.thirdparty_packagedb:
|
global thirdparty_packagedb
|
||||||
pisi.packagedb.thirdparty_packagedb = PackageDB('thirdparty')
|
global inst_packagedb
|
||||||
|
|
||||||
|
if not thirdparty_packagedb:
|
||||||
|
thirdparty_packagedb = PackageDB('thirdparty')
|
||||||
if not pisi.packagedb.inst_packagedb:
|
if not pisi.packagedb.inst_packagedb:
|
||||||
pisi.packagedb.inst_packagedb = PackageDB('installed')
|
inst_packagedb = PackageDB('installed')
|
||||||
|
|
||||||
def finalize_db():
|
def finalize_db():
|
||||||
if pisi.packagedb.thirdparty_packagedb:
|
global thirdparty_packagedb
|
||||||
pisi.packagedb.thirdparty_packagedb.close()
|
global inst_packagedb
|
||||||
if pisi.packagedb.inst_packagedb:
|
global packagedbs
|
||||||
pisi.packagedb.inst_packagedb.close()
|
|
||||||
if pisi.packagedb.packagedbs:
|
if thirdparty_packagedb:
|
||||||
del pisi.packagedb.packagedbs
|
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
|
db = None
|
||||||
|
|
||||||
def init():
|
def init():
|
||||||
if pisi.repodb.db:
|
global db
|
||||||
return pisi.repodb.db
|
|
||||||
|
|
||||||
pisi.repodb.db = RepoDB()
|
if db:
|
||||||
pisi.repodb.db.init_dbs()
|
return db
|
||||||
return pisi.repodb.db
|
|
||||||
|
db = RepoDB()
|
||||||
|
db.init_dbs()
|
||||||
|
return db
|
||||||
|
|
||||||
def finalize():
|
def finalize():
|
||||||
global db
|
global db
|
||||||
if pisi.repodb.db:
|
|
||||||
|
if db:
|
||||||
db.close()
|
db.close()
|
||||||
|
db = None
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user