Merge branch 'master' into staging

# Conflicts:
#	bauh/gems/appimage/controller.py
#	bauh/gems/arch/updates.py
This commit is contained in:
Vinicius Moreira
2022-12-12 07:53:51 -03:00
66 changed files with 249 additions and 245 deletions

View File

@@ -176,7 +176,7 @@ class AppImageManager(SoftwareManager, SettingsController):
if os.path.exists(db_path):
try:
return sqlite3.connect(db_path)
except:
except Exception:
self.logger.error(f"Could not connect to database file '{db_path}'")
traceback.print_exc()
else:
@@ -206,13 +206,13 @@ class AppImageManager(SoftwareManager, SettingsController):
not_installed.append(app)
found_map[self._gen_app_key(app)] = {'app': app, 'idx': idx}
idx += 1
except:
except Exception:
self.logger.error("An exception happened while querying the 'apps' database")
traceback.print_exc()
try:
installed = self.read_installed(connection=apps_conn, disk_loader=disk_loader, limit=limit, only_apps=False, pkg_types=None, internet_available=True).installed
except:
except Exception:
installed = None
installed_found = []
@@ -240,7 +240,7 @@ class AppImageManager(SoftwareManager, SettingsController):
installed_found.append(appim)
try:
apps_conn.close()
except:
except Exception:
self.logger.error(f"An exception happened when trying to close the connection to database file '{DATABASE_APPS_FILE}'")
traceback.print_exc()
@@ -290,7 +290,7 @@ class AppImageManager(SoftwareManager, SettingsController):
latest_version = normalize_version(tup[2])
installed_version = normalize_version(app.version)
app.update = latest_version > installed_version
except:
except Exception:
app.update = False
traceback.print_exc()
@@ -299,7 +299,7 @@ class AppImageManager(SoftwareManager, SettingsController):
app.url_download_latest_version = tup[3]
break
except:
except Exception:
self.logger.error(f"An exception happened while querying the database file '{DATABASE_APPS_FILE}'")
traceback.print_exc()
finally:
@@ -419,7 +419,7 @@ class AppImageManager(SoftwareManager, SettingsController):
try:
os.remove(pkg.symlink)
self.logger.info(f"symlink '{pkg.symlink}' successfully removed")
except:
except Exception:
msg = f"could not remove symlink '{pkg.symlink}'"
self.logger.error(msg)
@@ -492,7 +492,7 @@ class AppImageManager(SoftwareManager, SettingsController):
if not app_tuple:
self.logger.warning(f"Could not retrieve {pkg} from the database '{DATABASE_APPS_FILE}'")
return res
except:
except Exception:
self.logger.error(f"An exception happened while querying the database file '{DATABASE_APPS_FILE}'")
traceback.print_exc()
app_con.close()
@@ -523,7 +523,7 @@ class AppImageManager(SoftwareManager, SettingsController):
res.pkg_status_idx = idx
return res
except:
except Exception:
self.logger.error(f"An exception happened while querying the database file '{DATABASE_RELEASES_FILE}'")
traceback.print_exc()
finally:
@@ -601,7 +601,7 @@ class AppImageManager(SoftwareManager, SettingsController):
try:
moved, output = handler.handle_simple(SimpleProcess(['mv', pkg.local_file_path, install_file_path]))
except:
except Exception:
output = ''
self.logger.error(f"Could not rename file '{pkg.local_file_path}' as '{install_file_path}'")
moved = False
@@ -650,7 +650,7 @@ class AppImageManager(SoftwareManager, SettingsController):
type_=MessageType.ERROR)
handler.handle(SystemProcess(new_subprocess(['rm', '-rf', out_dir])))
return TransactionResult.fail()
except:
except Exception:
watcher.show_message(title=self.i18n['error'],
body=traceback.format_exc(),
type_=MessageType.ERROR)
@@ -692,7 +692,7 @@ class AppImageManager(SoftwareManager, SettingsController):
try:
shutil.rmtree(extracted_folder)
except:
except Exception:
traceback.print_exc()
SymlinksVerifier.create_symlink(app=pkg, file_path=install_file_path, logger=self.logger,
@@ -815,7 +815,7 @@ class AppImageManager(SoftwareManager, SettingsController):
self.logger.info(f"Mapped {len(res)} AppImage suggestions")
return res
except:
except Exception:
traceback.print_exc()
finally:
connection.close()
@@ -850,7 +850,7 @@ class AppImageManager(SoftwareManager, SettingsController):
if logs:
print(f'{Fore.YELLOW}[bauh][appimage] {f} deleted{Fore.RESET}')
except:
except Exception:
if logs:
print(f'{Fore.RED}[bauh][appimage] An exception has happened when deleting {f}{Fore.RESET}')
traceback.print_exc()
@@ -885,7 +885,7 @@ class AppImageManager(SoftwareManager, SettingsController):
try:
self.configman.save_config(config_)
return True, None
except:
except Exception:
return False, [traceback.format_exc()]
def gen_custom_actions(self) -> Generator[CustomSoftwareAction, None, None]:

View File

@@ -74,7 +74,7 @@ class DatabaseUpdater(Thread):
try:
dbs_timestamp = datetime.fromtimestamp(float(dbs_ts_str))
except:
except Exception:
self.logger.error('Could not parse the databases timestamp: {}'.format(dbs_ts_str))
traceback.print_exc()
return True
@@ -128,7 +128,7 @@ class DatabaseUpdater(Thread):
tf = tarfile.open(self.COMPRESS_FILE_PATH)
tf.extractall(APPIMAGE_CACHE_DIR)
self.logger.info('Successfully uncompressed file {}'.format(self.COMPRESS_FILE_PATH))
except:
except Exception:
self.logger.error('Could not extract file {}'.format(self.COMPRESS_FILE_PATH))
traceback.print_exc()
return False
@@ -209,7 +209,7 @@ class SymlinksVerifier(Thread):
else:
try:
Path(SYMLINKS_DIR).mkdir(parents=True, exist_ok=True)
except:
except Exception:
logger.error("Could not create symlink directory '{}'".format(SYMLINKS_DIR))
return
@@ -224,7 +224,7 @@ class SymlinksVerifier(Thread):
if watcher:
watcher.print(msg)
except:
except Exception:
msg = "Could not create the symlink '{}'".format(symlink_path)
logger.error(msg)
@@ -244,7 +244,7 @@ class SymlinksVerifier(Thread):
with open(json_file) as f:
try:
data = json.loads(f.read())
except:
except Exception:
self.logger.warning("Could not parse data from '{}'".format(json_file))
data = None
@@ -264,7 +264,7 @@ class SymlinksVerifier(Thread):
try:
with open(json_file, 'w+') as f:
f.write(json.dumps(data))
except:
except Exception:
self.logger.warning("Could not update cached data on '{}'".format(json_file))
traceback.print_exc()
@@ -335,7 +335,7 @@ class AppImageSuggestionsDownloader(Thread):
try:
exp_hours = int(appimage_config['suggestions']['expiration'])
except:
except Exception:
self.logger.error("An exception happened while trying to parse the AppImage 'suggestions.expiration'")
traceback.print_exc()
return True
@@ -357,7 +357,7 @@ class AppImageSuggestionsDownloader(Thread):
try:
suggestions_timestamp = datetime.fromtimestamp(float(timestamp_str))
except:
except Exception:
self.logger.error(f'Could not parse the cached AppImage suggestions timestamp: {timestamp_str}')
traceback.print_exc()
return True
@@ -405,14 +405,14 @@ class AppImageSuggestionsDownloader(Thread):
try:
with open(self.cached_file_path, 'w+') as f:
f.write(text)
except:
except Exception:
self.logger.error(f"An exception happened while writing AppImage suggestions to {self.cached_file_path}")
traceback.print_exc()
try:
with open(self.cached_ts_file_path, 'w+') as f:
f.write(str(timestamp))
except:
except Exception:
self.logger.error(f"An exception happened while writing the cached AppImage suggestions timestamp "
f"to {self.cached_ts_file_path}")
traceback.print_exc()
@@ -451,7 +451,7 @@ class AppImageSuggestionsDownloader(Thread):
ti = time.time()
if not self.is_custom_local_file_mapped():
if self.create_config:
if self.create_config:
wait_msg = self.i18n['task.waiting_task'].format(bold(self.create_config.task_name))
self.taskman.update_progress(self.task_id, 0, wait_msg)
self.create_config.join()
@@ -474,7 +474,7 @@ class AppImageSuggestionsDownloader(Thread):
self.cache_suggestions(suggestions_str, suggestions_timestamp)
else:
self.logger.info("Cached AppImage suggestions are up-to-date")
except:
except Exception:
self.logger.error("An unexpected exception happened while downloading AppImage suggestions")
traceback.print_exc()