mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-30 20:34:38 +01:00
Updated for flags
This commit is contained in:
parent
4f173fc305
commit
792da416bb
4 changed files with 23 additions and 13 deletions
|
@ -13,6 +13,7 @@ class Dependees:
|
||||||
def __init__(self, packages: list, flags: list):
|
def __init__(self, packages: list, flags: list):
|
||||||
self.packages = packages
|
self.packages = packages
|
||||||
self.flags = flags
|
self.flags = flags
|
||||||
|
self.flag_full_reverse = '--full-reverse'
|
||||||
self.configs = Configs
|
self.configs = Configs
|
||||||
self.session = Session
|
self.session = Session
|
||||||
self.ascii = Ascii()
|
self.ascii = Ascii()
|
||||||
|
@ -48,7 +49,7 @@ class Dependees:
|
||||||
else:
|
else:
|
||||||
print(f'{sp}{self.cyan}{dep[0]}{self.endc}')
|
print(f'{sp}{self.cyan}{dep[0]}{self.endc}')
|
||||||
|
|
||||||
if '--full-reverse' in self.flags:
|
if self.flag_full_reverse in self.flags:
|
||||||
if i == len(dependees):
|
if i == len(dependees):
|
||||||
print(" " * 4 + f' {self.llc}{self.hl} {self.violet}{dep[1]}{self.endc}')
|
print(" " * 4 + f' {self.llc}{self.hl} {self.violet}{dep[1]}{self.endc}')
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -33,6 +33,7 @@ class RemovePackages:
|
||||||
self.dependencies = []
|
self.dependencies = []
|
||||||
self.utils = Utilities()
|
self.utils = Utilities()
|
||||||
self.progress = ProgressBar()
|
self.progress = ProgressBar()
|
||||||
|
self.flag_resolve_off = '--resolve-off'
|
||||||
self.output = 0
|
self.output = 0
|
||||||
self.remove_pkg = None
|
self.remove_pkg = None
|
||||||
self.stderr = None
|
self.stderr = None
|
||||||
|
@ -50,7 +51,7 @@ class RemovePackages:
|
||||||
start = time.time()
|
start = time.time()
|
||||||
self.remove_packages()
|
self.remove_packages()
|
||||||
|
|
||||||
if self.dependencies and '--resolve-off' not in self.flags:
|
if self.dependencies and self.flag_resolve_off not in self.flags:
|
||||||
self.delete_deps_logs()
|
self.delete_deps_logs()
|
||||||
|
|
||||||
self.delete_main_logs()
|
self.delete_main_logs()
|
||||||
|
|
|
@ -48,6 +48,10 @@ class Slackbuilds:
|
||||||
self.dependencies = []
|
self.dependencies = []
|
||||||
self.sbos = {}
|
self.sbos = {}
|
||||||
self.progress = ProgressBar()
|
self.progress = ProgressBar()
|
||||||
|
self.flag_reinstall = '--reinstall'
|
||||||
|
self.flag_skip_installed = '--skip-installed'
|
||||||
|
self.flag_resolve_off = '--resolve-off'
|
||||||
|
self.flag_jobs = '--jobs'
|
||||||
self.process_message = None
|
self.process_message = None
|
||||||
self.output = 0
|
self.output = 0
|
||||||
self.stderr = None
|
self.stderr = None
|
||||||
|
@ -57,7 +61,7 @@ class Slackbuilds:
|
||||||
""" Starting build or install the slackbuilds. """
|
""" Starting build or install the slackbuilds. """
|
||||||
self.creating_dictionary()
|
self.creating_dictionary()
|
||||||
|
|
||||||
if '--resolve-off' not in self.flags:
|
if self.flag_resolve_off not in self.flags:
|
||||||
self.creating_dependencies_for_build()
|
self.creating_dependencies_for_build()
|
||||||
|
|
||||||
self.creating_main_for_build()
|
self.creating_main_for_build()
|
||||||
|
@ -81,7 +85,7 @@ class Slackbuilds:
|
||||||
for dep in deps:
|
for dep in deps:
|
||||||
|
|
||||||
# Checks if the package was installed and skipped.
|
# Checks if the package was installed and skipped.
|
||||||
if ('--skip-installed' in self.flags and
|
if (self.flag_skip_installed in self.flags and
|
||||||
self.utils.is_installed(dep)):
|
self.utils.is_installed(dep)):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -158,7 +162,7 @@ class Slackbuilds:
|
||||||
|
|
||||||
if (self.mode == 'install' and LooseVersion(repo_ver) > LooseVersion(inst_ver) or
|
if (self.mode == 'install' and LooseVersion(repo_ver) > LooseVersion(inst_ver) or
|
||||||
self.mode == 'upgrade' and package and LooseVersion(repo_ver) > LooseVersion(inst_ver) or
|
self.mode == 'upgrade' and package and LooseVersion(repo_ver) > LooseVersion(inst_ver) or
|
||||||
package and '--reinstall' in self.flags and self.mode == 'install' or self.mode == 'build'):
|
package and self.flag_reinstall in self.flags and self.mode == 'install' or self.mode == 'build'):
|
||||||
|
|
||||||
file = f'{sbo}{self.configs.sbo_tar_suffix}'
|
file = f'{sbo}{self.configs.sbo_tar_suffix}'
|
||||||
|
|
||||||
|
@ -185,7 +189,7 @@ class Slackbuilds:
|
||||||
pkg = self.creating_package_for_install(sbo)
|
pkg = self.creating_package_for_install(sbo)
|
||||||
self.install_package(pkg)
|
self.install_package(pkg)
|
||||||
|
|
||||||
if '--resolve-off' not in self.flags:
|
if self.flag_resolve_off not in self.flags:
|
||||||
self.logging_installed_dependencies(sbo)
|
self.logging_installed_dependencies(sbo)
|
||||||
else:
|
else:
|
||||||
version = self.utils.split_installed_pkg(package)[1]
|
version = self.utils.split_installed_pkg(package)[1]
|
||||||
|
@ -229,7 +233,7 @@ class Slackbuilds:
|
||||||
pkg = self.utils.split_installed_pkg(package)[0]
|
pkg = self.utils.split_installed_pkg(package)[0]
|
||||||
|
|
||||||
execute = self.configs.installpkg
|
execute = self.configs.installpkg
|
||||||
if ('--reinstall' in self.flags and
|
if (self.flag_reinstall in self.flags and
|
||||||
self.utils.is_installed(pkg)):
|
self.utils.is_installed(pkg)):
|
||||||
execute = self.configs.reinstall
|
execute = self.configs.reinstall
|
||||||
|
|
||||||
|
@ -266,7 +270,7 @@ class Slackbuilds:
|
||||||
for file in os.listdir(folder):
|
for file in os.listdir(folder):
|
||||||
os.chown(f'{folder}{file}', 0, 0)
|
os.chown(f'{folder}{file}', 0, 0)
|
||||||
|
|
||||||
if '--jobs' in self.flags:
|
if self.flag_jobs in self.flags:
|
||||||
self.set_makeflags()
|
self.set_makeflags()
|
||||||
|
|
||||||
message = f'{self.red}Build{self.endc}'
|
message = f'{self.red}Build{self.endc}'
|
||||||
|
|
|
@ -21,6 +21,9 @@ class ViewMessage:
|
||||||
|
|
||||||
def __init__(self, flags: list):
|
def __init__(self, flags: list):
|
||||||
self.flags = flags
|
self.flags = flags
|
||||||
|
self.flag_resolve_off = '--resolve-off'
|
||||||
|
self.flag_reinstall = '--reinstall'
|
||||||
|
self.flag_yes = '--yes'
|
||||||
self.session = Session
|
self.session = Session
|
||||||
self.utils = Utilities()
|
self.utils = Utilities()
|
||||||
self.black = Blacklist()
|
self.black = Blacklist()
|
||||||
|
@ -157,7 +160,7 @@ class ViewMessage:
|
||||||
if requires:
|
if requires:
|
||||||
dependencies += requires[0].split()
|
dependencies += requires[0].split()
|
||||||
|
|
||||||
if dependencies and '--resolve-off' not in self.flags:
|
if dependencies and self.flag_resolve_off not in self.flags:
|
||||||
dependencies = self.choose_dependencies_for_remove(dependencies)
|
dependencies = self.choose_dependencies_for_remove(dependencies)
|
||||||
|
|
||||||
self.draw_title_box('The following packages will be removed:', 'Remove Packages')
|
self.draw_title_box('The following packages will be removed:', 'Remove Packages')
|
||||||
|
@ -165,7 +168,7 @@ class ViewMessage:
|
||||||
for pkg in slackbuilds:
|
for pkg in slackbuilds:
|
||||||
self._view_removed(pkg)
|
self._view_removed(pkg)
|
||||||
|
|
||||||
if dependencies and '--resolve-off' not in self.flags:
|
if dependencies and self.flag_resolve_off not in self.flags:
|
||||||
self.draw_middle_line()
|
self.draw_middle_line()
|
||||||
self.draw_dependency_line()
|
self.draw_dependency_line()
|
||||||
|
|
||||||
|
@ -226,9 +229,10 @@ class ViewMessage:
|
||||||
|
|
||||||
if not installed:
|
if not installed:
|
||||||
install += 1
|
install += 1
|
||||||
elif installed and '--reinstall' in self.flags:
|
elif installed and self.flag_reinstall in self.flags:
|
||||||
upgrade += 1
|
upgrade += 1
|
||||||
elif installed and LooseVersion(repo_ver) > LooseVersion(inst_ver) and '--reinstall' not in self.flags:
|
elif (installed and LooseVersion(repo_ver) > LooseVersion(inst_ver) and
|
||||||
|
self.flag_reinstall not in self.flags):
|
||||||
upgrade += 1
|
upgrade += 1
|
||||||
elif installed and option == 'remove':
|
elif installed and option == 'remove':
|
||||||
remove += 1
|
remove += 1
|
||||||
|
@ -262,7 +266,7 @@ class ViewMessage:
|
||||||
|
|
||||||
def question(self):
|
def question(self):
|
||||||
""" Manage to proceed. """
|
""" Manage to proceed. """
|
||||||
if '--yes' not in self.flags:
|
if self.flag_yes not in self.flags:
|
||||||
answer = input('\nDo you want to continue? [y/N] ')
|
answer = input('\nDo you want to continue? [y/N] ')
|
||||||
if answer not in ['Y', 'y']:
|
if answer not in ['Y', 'y']:
|
||||||
raise SystemExit()
|
raise SystemExit()
|
||||||
|
|
Loading…
Add table
Reference in a new issue