Change logging a little so info about DB being rebuilt is always printed to stdout
This commit is contained in:
12
db_update.py
12
db_update.py
@@ -51,6 +51,7 @@ def db_needs_update():
|
||||
except:
|
||||
return None
|
||||
if not os.path.isfile(DB_PATH):
|
||||
print('Gamedata DB not found')
|
||||
return True
|
||||
db_data_version = None
|
||||
db_schema_version = None
|
||||
@@ -68,12 +69,21 @@ def db_needs_update():
|
||||
except KeyboardInterrupt:
|
||||
raise
|
||||
except:
|
||||
print('Error when fetching gamedata DB metadata')
|
||||
return True
|
||||
return data_version != db_data_version or GAMEDATA_SCHEMA_VERSION != db_schema_version
|
||||
if data_version != db_data_version:
|
||||
print('Gamedata DB data version mismatch: needed {}, DB has {}'.format(data_version, db_data_version))
|
||||
return True
|
||||
if GAMEDATA_SCHEMA_VERSION != db_schema_version:
|
||||
print('Gamedata DB schema version mismatch: needed {}, DB has {}'.format(GAMEDATA_SCHEMA_VERSION, db_schema_version))
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def update_db():
|
||||
|
||||
print('Building gamedata DB...')
|
||||
|
||||
if os.path.isfile(DB_PATH):
|
||||
os.remove(DB_PATH)
|
||||
|
||||
|
||||
2
pyfa.py
2
pyfa.py
@@ -76,6 +76,7 @@ parser.add_option("-p", "--profile", action="store", dest="profile_path", help="
|
||||
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
try:
|
||||
@@ -118,7 +119,6 @@ if __name__ == "__main__":
|
||||
pyfalog.info("Running in a thawed state.")
|
||||
|
||||
if db_needs_update() is True:
|
||||
pyfalog.info("Gamedata needs an update")
|
||||
update_db()
|
||||
|
||||
# Lets get to the good stuff, shall we?
|
||||
|
||||
Reference in New Issue
Block a user