* another try
This commit is contained in:
+6
-6
@@ -38,17 +38,17 @@ class Error(pisi.Error):
|
|||||||
|
|
||||||
def upgrade_pisi():
|
def upgrade_pisi():
|
||||||
"""forces to reload pisi modules and runs rebuild-db if needed."""
|
"""forces to reload pisi modules and runs rebuild-db if needed."""
|
||||||
|
import pisi
|
||||||
|
import pisi.context as ctx
|
||||||
|
import pisi.version
|
||||||
|
|
||||||
old_filesdbversion = pisi.__filesdbversion__
|
old_filesdbversion = pisi.__filesdbversion__
|
||||||
old_dbversion = pisi.__dbversion__
|
old_dbversion = pisi.__dbversion__
|
||||||
|
|
||||||
def rebuild_db():
|
def rebuild_db():
|
||||||
"""rebuild_db is necessary if database structures has changed."""
|
"""rebuild_db is necessary if database structures has changed."""
|
||||||
from pisi.version import Version
|
if pisi.version.Version(pisi.__filesdbversion__) > pisi.version.Version(old_filesdbversion) or \
|
||||||
import pisi.context as ctx
|
pisi.version.Version(pisi.__dbversion__) > pisi.version.Version(old_dbversion):
|
||||||
|
|
||||||
if Version(pisi.__filesdbversion__) > Version(old_filesdbversion) or \
|
|
||||||
Version(pisi.__dbversion__) > Version(old_dbversion):
|
|
||||||
pisi.api.init(database=False)
|
pisi.api.init(database=False)
|
||||||
ctx.ui.info(_("* PiSi database version has changed. Rebuilding database..."))
|
ctx.ui.info(_("* PiSi database version has changed. Rebuilding database..."))
|
||||||
pisi.api.rebuild_db()
|
pisi.api.rebuild_db()
|
||||||
@@ -60,10 +60,10 @@ def upgrade_pisi():
|
|||||||
if module.startswith("pisi."):
|
if module.startswith("pisi."):
|
||||||
"""removal from sys.modules forces reload via import"""
|
"""removal from sys.modules forces reload via import"""
|
||||||
del(sys.modules[module])
|
del(sys.modules[module])
|
||||||
reload(pisi)
|
|
||||||
|
|
||||||
pisi.api.finalize()
|
pisi.api.finalize()
|
||||||
reload_pisi()
|
reload_pisi()
|
||||||
|
reload(pisi)
|
||||||
rebuild_db()
|
rebuild_db()
|
||||||
pisi.api.init()
|
pisi.api.init()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user