mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2024-12-26 09:58:31 +01:00
Updated for inheritance classes
This commit is contained in:
parent
08a911c75c
commit
644522f2a7
2 changed files with 11 additions and 18 deletions
|
@ -11,16 +11,16 @@ from slpkg.views.views import ViewMessage
|
|||
from slpkg.models.models import session as Session
|
||||
|
||||
|
||||
class Download:
|
||||
class Download(Configs, Utilities):
|
||||
""" Download the slackbuilds with the sources only. """
|
||||
|
||||
def __init__(self, directory: str, flags: list):
|
||||
super(Configs, self).__init__()
|
||||
super(Utilities, self).__init__()
|
||||
self.flags = flags
|
||||
self.directory = directory
|
||||
self.flag_directory = '--directory='
|
||||
self.configs = Configs
|
||||
self.session = Session
|
||||
self.utils = Utilities()
|
||||
|
||||
def packages(self, slackbuilds: list):
|
||||
""" Download the package only. """
|
||||
|
@ -28,15 +28,15 @@ class Download:
|
|||
view.download_packages(slackbuilds)
|
||||
view.question()
|
||||
|
||||
download_path = self.configs.download_only
|
||||
download_path = self.download_only
|
||||
if self.flag_directory in self.flags:
|
||||
download_path = self.directory
|
||||
|
||||
start = time.time()
|
||||
for sbo in slackbuilds:
|
||||
file = f'{sbo}{self.configs.sbo_tar_suffix}'
|
||||
file = f'{sbo}{self.sbo_tar_suffix}'
|
||||
location = SBoQueries(sbo).location()
|
||||
url = f'{self.configs.sbo_repo_url}/{location}/{file}'
|
||||
url = f'{self.sbo_repo_url}/{location}/{file}'
|
||||
|
||||
down_sbo = Downloader(download_path, url, self.flags)
|
||||
down_sbo.download()
|
||||
|
@ -47,4 +47,4 @@ class Download:
|
|||
down_source.download()
|
||||
|
||||
elapsed_time = time.time() - start
|
||||
self.utils.finished_time(elapsed_time)
|
||||
self.finished_time(elapsed_time)
|
||||
|
|
|
@ -1,36 +1,29 @@
|
|||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from slpkg.configs import Configs
|
||||
from slpkg.queries import SBoQueries
|
||||
from slpkg.utilities import Utilities
|
||||
from slpkg.blacklist import Blacklist
|
||||
from slpkg.dialog_box import DialogBox
|
||||
from slpkg.dependencies import Requires
|
||||
|
||||
|
||||
class Upgrade:
|
||||
class Upgrade(Utilities):
|
||||
""" Upgrade the installed packages. """
|
||||
|
||||
def __init__(self):
|
||||
self.configs = Configs
|
||||
self.utils = Utilities()
|
||||
self.dialog = DialogBox()
|
||||
|
||||
def packages(self):
|
||||
""" Compares version of packages and returns the maximum. """
|
||||
repo_packages = SBoQueries('').sbos()
|
||||
black = Blacklist().get()
|
||||
upgrade, requires = [], []
|
||||
|
||||
installed = self.utils.all_installed()
|
||||
installed = self.all_installed()
|
||||
|
||||
for pkg in installed:
|
||||
inst_pkg_name = self.utils.split_installed_pkg(pkg)[0]
|
||||
inst_pkg_name = self.split_installed_pkg(pkg)[0]
|
||||
|
||||
if inst_pkg_name not in black and inst_pkg_name in repo_packages:
|
||||
|
||||
if self.utils.is_repo_version_bigger(inst_pkg_name):
|
||||
if self.is_repo_version_bigger(inst_pkg_name):
|
||||
requires += Requires(inst_pkg_name).resolve()
|
||||
upgrade.append(inst_pkg_name)
|
||||
|
||||
|
|
Loading…
Reference in a new issue