Backup #16

Merged
cswimr merged 41 commits from backup into main 2024-01-31 15:58:08 -05:00
Showing only changes of commit 760059f8f0 - Show all commits

View file

@ -144,11 +144,16 @@ class Backup(commands.Cog):
continue
else:
cog_names = []
cog_modules = []
for cog in cogs:
cog_names.append(cog['name'])
try:
cog_module = InstalledCog.convert(ctx, cog['name'])
except commands.BadArgument:
uninstall_e.append(f"Failed to uninstall {cog['name']}")
continue
cog_modules.append(cog_module)
for cog in set(cog_names):
for cog in set(cog.name for cog in cog_modules):
poss_installed_path = (await downloader.cog_install_path()) / cog
if poss_installed_path.exists():
with contextlib.suppress(commands.ExtensionNotLoaded):
@ -157,7 +162,7 @@ class Backup(commands.Cog):
await downloader._delete_cog(poss_installed_path)
else:
uninstall_e.append(f"Failed to uninstall {cog}")
await downloader._remove_from_installed(cog)
await downloader._remove_from_installed(cog_modules)
for cog in cogs:
cog_name = cog['name']
@ -168,16 +173,16 @@ class Backup(commands.Cog):
commit = None
async with repository.checkout(commit, exit_to_rev=repo.branch):
cogs, message = await downloader._filter_incorrect_cogs_by_names(repository, [cog_name]) # pylint: disable=protected-access
cogs_c, message = await downloader._filter_incorrect_cogs_by_names(repository, [cog_name]) # pylint: disable=protected-access
if not cogs:
install_e.append(message)
continue
failed_reqs = await downloader._install_requirements(cogs)
failed_reqs = await downloader._install_requirements(cogs_c)
if failed_reqs:
install_e.append(f"Failed to install {cog_name} due to missing requirements: {failed_reqs}")
continue
installed_cogs, failed_cogs = await downloader._install_cogs(cogs)
installed_cogs, failed_cogs = await downloader._install_cogs(cogs_c)
if repo.available_libraries:
installed_libs, failed_libs = await repository.install_libraries(target_dir=downloader.SHAREDLIB_PATH, req_target_dir=downloader.LIB_PATH)