From cde0108cbadbabdd3eec8dade334f8435f023d55 Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Wed, 30 Oct 2019 15:16:13 +0300 Subject: [PATCH] Change logging a little so info about DB being rebuilt is always printed to stdout --- db_update.py | 12 +++++++++++- pyfa.py | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/db_update.py b/db_update.py index 7c8618bfa..a44ba2064 100644 --- a/db_update.py +++ b/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) diff --git a/pyfa.py b/pyfa.py index 559e75a41..8917d89de 100755 --- a/pyfa.py +++ b/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?