forked from blizzthewolf/SeaCogs
fix(backup): fixed some stuff
This commit is contained in:
parent
f4f174ce81
commit
760059f8f0
1 changed files with 12 additions and 7 deletions
|
@ -144,11 +144,16 @@ class Backup(commands.Cog):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
else:
|
else:
|
||||||
cog_names = []
|
cog_modules = []
|
||||||
for cog in cogs:
|
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
|
poss_installed_path = (await downloader.cog_install_path()) / cog
|
||||||
if poss_installed_path.exists():
|
if poss_installed_path.exists():
|
||||||
with contextlib.suppress(commands.ExtensionNotLoaded):
|
with contextlib.suppress(commands.ExtensionNotLoaded):
|
||||||
|
@ -157,7 +162,7 @@ class Backup(commands.Cog):
|
||||||
await downloader._delete_cog(poss_installed_path)
|
await downloader._delete_cog(poss_installed_path)
|
||||||
else:
|
else:
|
||||||
uninstall_e.append(f"Failed to uninstall {cog}")
|
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:
|
for cog in cogs:
|
||||||
cog_name = cog['name']
|
cog_name = cog['name']
|
||||||
|
@ -168,16 +173,16 @@ class Backup(commands.Cog):
|
||||||
commit = None
|
commit = None
|
||||||
|
|
||||||
async with repository.checkout(commit, exit_to_rev=repo.branch):
|
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:
|
if not cogs:
|
||||||
install_e.append(message)
|
install_e.append(message)
|
||||||
continue
|
continue
|
||||||
failed_reqs = await downloader._install_requirements(cogs)
|
failed_reqs = await downloader._install_requirements(cogs_c)
|
||||||
if failed_reqs:
|
if failed_reqs:
|
||||||
install_e.append(f"Failed to install {cog_name} due to missing requirements: {failed_reqs}")
|
install_e.append(f"Failed to install {cog_name} due to missing requirements: {failed_reqs}")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
installed_cogs, failed_cogs = await downloader._install_cogs(cogs)
|
installed_cogs, failed_cogs = await downloader._install_cogs(cogs_c)
|
||||||
|
|
||||||
if repo.available_libraries:
|
if repo.available_libraries:
|
||||||
installed_libs, failed_libs = await repository.install_libraries(target_dir=downloader.SHAREDLIB_PATH, req_target_dir=downloader.LIB_PATH)
|
installed_libs, failed_libs = await repository.install_libraries(target_dir=downloader.SHAREDLIB_PATH, req_target_dir=downloader.LIB_PATH)
|
||||||
|
|
Loading…
Reference in a new issue