mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-18 10:26:29 +01:00
Updated for repo name
This commit is contained in:
parent
f81f1051d2
commit
59ceab3ee7
7 changed files with 35 additions and 26 deletions
|
@ -23,13 +23,12 @@ from slpkg.models.models import session as Session
|
|||
|
||||
class Packages(Configs):
|
||||
|
||||
def __init__(self, data: dict, packages: list, flags: list, repo: str, mode: str):
|
||||
__slots__ = 'data', 'packages', 'flags', 'repo', 'mode'
|
||||
def __init__(self, data: dict, packages: list, flags: list, mode: str):
|
||||
__slots__ = 'data', 'packages', 'flags', 'mode'
|
||||
super(Configs, self).__init__()
|
||||
self.data: dict = data
|
||||
self.packages: list = packages
|
||||
self.flags: list = flags
|
||||
self.repo: str = repo
|
||||
self.mode: str = mode
|
||||
|
||||
self.progress = ProgressBar()
|
||||
|
@ -37,8 +36,8 @@ class Packages(Configs):
|
|||
self.utils = Utilities()
|
||||
self.repos = Repositories()
|
||||
self.dialogbox = DialogBox()
|
||||
self.upgrade = Upgrade(self.flags, self.data, self.repo)
|
||||
self.view_message = ViewMessage(self.flags, self.data, self.repo)
|
||||
self.upgrade = Upgrade(self.flags, self.data)
|
||||
self.view_message = ViewMessage(self.flags, self.data)
|
||||
self.session = Session
|
||||
|
||||
self.output: int = 0
|
||||
|
@ -95,7 +94,7 @@ class Packages(Configs):
|
|||
if self.option_for_skip_installed and self.utils.is_package_installed(pkg):
|
||||
continue
|
||||
|
||||
self.packages_requires += Required(self.data, pkg, self.repo).resolve()
|
||||
self.packages_requires += Required(self.data, pkg).resolve()
|
||||
|
||||
# Clean dependencies from the dependencies list if already added with main packages.
|
||||
requires = list(OrderedDict.fromkeys(self.packages_requires))
|
||||
|
@ -178,7 +177,7 @@ class Packages(Configs):
|
|||
exist = self.session.query(LogsDependencies.name).filter(
|
||||
LogsDependencies.name == name).first()
|
||||
|
||||
requires: list = Required(self.data, name, self.repo).resolve()
|
||||
requires: list = Required(self.data, name).resolve()
|
||||
|
||||
# Update the dependencies if exist else create it.
|
||||
if exist:
|
||||
|
|
|
@ -9,11 +9,10 @@ class Required:
|
|||
""" Creates a list of dependencies with
|
||||
the right order to install. """
|
||||
|
||||
def __init__(self, data: dict, name: str, repo: str):
|
||||
__slots__ = 'data', 'name,' 'repo'
|
||||
def __init__(self, data: dict, name: str):
|
||||
__slots__ = 'data', 'name,'
|
||||
self.data: dict = data
|
||||
self.name: str = name
|
||||
self.repo: str = repo
|
||||
self.repos = Repositories()
|
||||
self.utils = Utilities()
|
||||
|
||||
|
@ -24,6 +23,8 @@ class Required:
|
|||
self.repos.slint_repo_name
|
||||
]
|
||||
|
||||
self.repo = self.utils.get_the_repo_name(self.data)
|
||||
|
||||
def resolve(self) -> list:
|
||||
""" Resolve the dependencies. """
|
||||
required: list[str] = self.data[self.name][6].split()
|
||||
|
|
|
@ -32,11 +32,11 @@ class Download(Configs):
|
|||
self.option_for_binaries: bool = self.utils.is_option(
|
||||
['-B', '--bin-repo='], self.flags)
|
||||
|
||||
def packages(self, data: dict, packages: list, repo=None) -> None:
|
||||
def packages(self, data: dict, packages: list) -> None:
|
||||
""" Download the package only. """
|
||||
packages: list = self.utils.apply_package_pattern(data, packages)
|
||||
|
||||
view = ViewMessage(self.flags, data, repo)
|
||||
view = ViewMessage(self.flags, data)
|
||||
view.download_packages(packages, self.directory)
|
||||
view.question()
|
||||
|
||||
|
|
|
@ -527,7 +527,7 @@ class Argparse(Configs):
|
|||
if len(self.args) == 1:
|
||||
self.check.is_empty_database()
|
||||
|
||||
upgrade = Upgrade(self.flags, self.data, self.binary_repo)
|
||||
upgrade = Upgrade(self.flags, self.data)
|
||||
packages: list = list(upgrade.packages())
|
||||
|
||||
packages: list = self.choose_packages(packages, command)
|
||||
|
@ -537,7 +537,7 @@ class Argparse(Configs):
|
|||
raise SystemExit()
|
||||
|
||||
if self.utils.is_option(self.flag_binaries, self.flags):
|
||||
install = Packages(self.data, packages, self.flags, self.binary_repo, mode=command)
|
||||
install = Packages(self.data, packages, self.flags, mode=command)
|
||||
install.execute()
|
||||
else:
|
||||
install = Slackbuilds(self.data, packages, self.flags, mode=command)
|
||||
|
@ -631,7 +631,7 @@ class Argparse(Configs):
|
|||
if self.utils.is_option(self.flag_binaries, self.flags):
|
||||
self.check.exists_in_the_database(packages)
|
||||
|
||||
install = Packages(self.data, packages, self.flags, self.binary_repo, mode=command)
|
||||
install = Packages(self.data, packages, self.flags, mode=command)
|
||||
install.execute()
|
||||
else:
|
||||
self.check.exists_in_the_database(packages)
|
||||
|
@ -655,7 +655,7 @@ class Argparse(Configs):
|
|||
|
||||
self.check.exists_in_the_database(packages)
|
||||
download = Download(self.directory, self.flags)
|
||||
download.packages(self.data, packages, self.binary_repo)
|
||||
download.packages(self.data, packages)
|
||||
raise SystemExit()
|
||||
self.usage.help_short(1)
|
||||
|
||||
|
|
|
@ -14,18 +14,19 @@ from slpkg.logging_config import LoggingConfig
|
|||
class Upgrade(Configs):
|
||||
""" Upgrade the installed packages. """
|
||||
|
||||
def __init__(self, flags: list, data: dict, repo=None):
|
||||
__slots__ = 'flags', 'data', 'repo'
|
||||
def __init__(self, flags: list, data: dict):
|
||||
__slots__ = 'flags', 'data'
|
||||
super(Configs, self).__init__()
|
||||
self.flags: list = flags
|
||||
self.data: dict = data
|
||||
self.repo: str = repo
|
||||
self.utils = Utilities()
|
||||
self.repos = Repositories()
|
||||
|
||||
self.option_for_binaries: bool = self.utils.is_option(
|
||||
['-B', '--bin-repo='], self.flags)
|
||||
|
||||
self.repo: str = self.utils.get_the_repo_name(self.data)
|
||||
|
||||
logging.basicConfig(filename=str(LoggingConfig.log_file),
|
||||
filemode='w',
|
||||
encoding='utf-8',
|
||||
|
|
|
@ -192,3 +192,12 @@ class Utilities:
|
|||
""" This module provides support for Unix shell-style wildcards. """
|
||||
if [black for black in self.black.packages() if fnmatch.fnmatch(name, black)]:
|
||||
return True
|
||||
|
||||
def get_the_repo_name(self, data):
|
||||
""" Get the binary repository name from the repository data. """
|
||||
try:
|
||||
repo: list = list(data.values())[0][11]
|
||||
except IndexError:
|
||||
repo: str = self.repos.sbo_enabled_repository
|
||||
|
||||
return repo
|
||||
|
|
|
@ -18,18 +18,17 @@ from slpkg.models.models import session as Session
|
|||
|
||||
class ViewMessage(Configs):
|
||||
|
||||
def __init__(self, flags: list, data=None, repo=None):
|
||||
__slots__ = 'flags', 'data', 'repo'
|
||||
def __init__(self, flags: list, data=None):
|
||||
__slots__ = 'flags', 'data'
|
||||
super(Configs, self).__init__()
|
||||
self.flags: list = flags
|
||||
self.data: dict = data
|
||||
self.repo: str = repo
|
||||
|
||||
self.session = Session
|
||||
self.utils = Utilities()
|
||||
self.dialogbox = DialogBox()
|
||||
self.ascii = Ascii()
|
||||
self.upgrade = Upgrade(self.flags, self.data, self.repo)
|
||||
self.upgrade = Upgrade(self.flags, self.data)
|
||||
self.color = self.colour()
|
||||
self.repos = Repositories()
|
||||
|
||||
|
@ -54,6 +53,8 @@ class ViewMessage(Configs):
|
|||
self.option_for_binaries: bool = self.utils.is_option(
|
||||
['-B', '--bin-repo='], self.flags)
|
||||
|
||||
self.repo: str = self.utils.get_the_repo_name(self.data)
|
||||
|
||||
def view_packages(self, package: str, mode: str) -> None:
|
||||
""" Printing the main packages. """
|
||||
size: str = ''
|
||||
|
@ -64,10 +65,8 @@ class ViewMessage(Configs):
|
|||
size: str = self.utils.convert_file_sizes(
|
||||
int(''.join(re.findall(r'\d+', self.data[package][4])))
|
||||
)
|
||||
repo: str = self.repo
|
||||
else:
|
||||
version: str = self.data[package][2]
|
||||
repo: str = self.repos.sbo_enabled_repository
|
||||
|
||||
if mode in ['install', 'download']:
|
||||
color: str = self.cyan
|
||||
|
@ -87,7 +86,7 @@ class ViewMessage(Configs):
|
|||
and self.option_for_reinstall):
|
||||
color: str = self.violet
|
||||
|
||||
self.ascii.draw_view_package(package, version, size, color, repo)
|
||||
self.ascii.draw_view_package(package, version, size, color, self.repo)
|
||||
|
||||
def view_skipping_packages(self, package: str, version: str) -> None:
|
||||
""" Print the skipping packages. """
|
||||
|
|
Loading…
Reference in a new issue