mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-30 20:34:38 +01:00
Updated for cleanings
This commit is contained in:
parent
467bf18562
commit
e353a60196
2 changed files with 13 additions and 12 deletions
|
@ -26,7 +26,7 @@ class Cleanings(Configs):
|
|||
self.repos = Repositories()
|
||||
self.utils = Utilities()
|
||||
|
||||
def tmp(self):
|
||||
def tmp(self) -> None:
|
||||
print('Deleting of local data:\n')
|
||||
|
||||
for file in self.tmp_slpkg.glob('*'):
|
||||
|
@ -35,14 +35,13 @@ class Cleanings(Configs):
|
|||
print(f"\n{self.prog_name}: {self.blink}{self.bold}{self.bred}WARNING!{self.endc}: All the files and "
|
||||
f"folders will delete!")
|
||||
|
||||
views = ViewMessage(self.flags)
|
||||
views.question()
|
||||
self.view.question()
|
||||
|
||||
self.utils.remove_folder_if_exists(self.tmp_slpkg)
|
||||
self.utils.create_directory(self.build_path)
|
||||
print(f'{self.byellow}Successfully cleared!{self.endc}\n')
|
||||
|
||||
def logs_deps(self) -> None:
|
||||
def logs_dependencies(self) -> None:
|
||||
""" Deletes the log table from the database. """
|
||||
dependencies: list = self.session.query(
|
||||
LogsDependencies.name, LogsDependencies.requires).all() # type: ignore
|
||||
|
@ -50,12 +49,14 @@ class Cleanings(Configs):
|
|||
if dependencies:
|
||||
self.view.logs_packages(dependencies)
|
||||
self.view.question()
|
||||
|
||||
self.session.query(LogsDependencies).delete()
|
||||
self.session.commit()
|
||||
self.delete_logs_of_dependencies()
|
||||
else:
|
||||
print('\nNothing to clean.\n')
|
||||
|
||||
def delete_logs_of_dependencies(self):
|
||||
self.session.query(LogsDependencies).delete()
|
||||
self.session.commit()
|
||||
|
||||
def db_tables(self) -> None:
|
||||
""" Drop all the tables from the database. """
|
||||
print('Deleting repositories of local data and the database:\n')
|
||||
|
@ -83,8 +84,8 @@ class Cleanings(Configs):
|
|||
"You need to update the package lists now:\n\n"
|
||||
" $ slpkg update\n")
|
||||
|
||||
def delete_repositories_data(self):
|
||||
def delete_repositories_data(self) -> None:
|
||||
""" Deletes local folders with the repository downloaded data. """
|
||||
for repo, values in self.repos.repositories.items():
|
||||
if values[1].exists() and isinstance(values[1], PosixPath):
|
||||
shutil.rmtree(values[1])
|
||||
for repo, path in self.repos.repositories.items():
|
||||
if path[1].exists() and isinstance(path[1], PosixPath):
|
||||
shutil.rmtree(path[1])
|
||||
|
|
|
@ -568,7 +568,7 @@ class Argparse(Configs):
|
|||
def clean_logs(self) -> None:
|
||||
if len(self.args) == 1:
|
||||
clean = Cleanings(self.flags)
|
||||
clean.logs_deps()
|
||||
clean.logs_dependencies()
|
||||
raise SystemExit()
|
||||
self.usage.help_short(1)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue