diff --git a/ChangeLog.txt b/ChangeLog.txt index e14d1d8e..1fb87d02 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,7 @@ +4.4.1 - 28/12/2022 +Added: +- configs command to read and edit configuration file + 4.4.0 - 23/12/2022 Added: - New command to tracking the dependencies diff --git a/README.rst b/README.rst index 1c8bb9b2..c1b6b2a0 100644 --- a/README.rst +++ b/README.rst @@ -31,10 +31,31 @@ Install from the official third-party `SBo repository Build only the packages. @@ -112,7 +134,7 @@ Usage Do you want to continue (y/N)?: - $ slpkg dependees vlc + $ slpkg dependees vlc --full-reverse The list below shows the packages that dependees 'vlc' files: Collecting the data... diff --git a/man/slpkg.1 b/man/slpkg.1 index 93e0aef7..3e409ed4 100644 --- a/man/slpkg.1 +++ b/man/slpkg.1 @@ -4,7 +4,7 @@ slpkg - [OPTIONS] [COMMAND] .SH SYNAPSES .P -slpkg [-h|-v] [update] [upgrade] [check-updates] [clean-logs] [clean-tmp] [-b, build] [-i, install] [-d, download] +slpkg [-h|-v] [update] [upgrade] [check-updates] [configs] [clean-logs] [clean-tmp] [-b, build] [-i, install] [-d, download] [-r, remove] [-f, find] [-w, view] [-s, search] [-e, dependees] [-t, tracking] --yes, --jobs, --resolve-off, --reinstall, --skip-installed, --full-reverse, --search .SH DESCRIPTION @@ -32,6 +32,11 @@ check-updates Check if there is any news on the SlackBuild's ChangeLog.txt file. .RE .P +configs +.RS +Edit the configuration /etc/slpkg/slpkg.toml file. +.RE +.P clean-logs .RS Cleans dependencies log tracking. After that procedure you should remove dependencies by hand. diff --git a/setup.cfg b/setup.cfg index e0a7ee49..63cea190 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = slpkg -version = 4.4.0 +version = 4.4.1 license_file = LICENSE author = Dimitris Zlatanidis author_email = d.zlatanidis@gmail.com diff --git a/slpkg/blacklist.py b/slpkg/blacklist.py index 412b0828..9b62a48d 100644 --- a/slpkg/blacklist.py +++ b/slpkg/blacklist.py @@ -1,7 +1,6 @@ #!/usr/bin/python3 # -*- coding: utf-8 -*- - import os import tomli diff --git a/slpkg/check_updates.py b/slpkg/check_updates.py index dfc96b8b..808a6991 100644 --- a/slpkg/check_updates.py +++ b/slpkg/check_updates.py @@ -1,7 +1,6 @@ #!/usr/bin/python3 # -*- coding: utf-8 -*- - import os import urllib3 diff --git a/slpkg/checksum.py b/slpkg/checksum.py index 8bf953bf..fba7cdb1 100644 --- a/slpkg/checksum.py +++ b/slpkg/checksum.py @@ -1,7 +1,6 @@ #!/usr/bin/python3 # -*- coding: utf-8 -*- - import hashlib from slpkg.views.views import ViewMessage @@ -30,7 +29,7 @@ class Md5sum: view.question() @staticmethod - def read_file(filename: str): + def read_file(filename: str) -> bytes: """ Reads the text file. """ with open(filename, 'rb') as f: return f.read() diff --git a/slpkg/clean_logs.py b/slpkg/clean_logs.py index 5d617602..5ccfd7bd 100644 --- a/slpkg/clean_logs.py +++ b/slpkg/clean_logs.py @@ -1,7 +1,6 @@ #!/usr/bin/python3 # -*- coding: utf-8 -*- - from slpkg.views.views import ViewMessage from slpkg.models.models import LogsDependencies from slpkg.models.models import session as Session diff --git a/slpkg/configs.py b/slpkg/configs.py index 18efcb80..02dd22eb 100644 --- a/slpkg/configs.py +++ b/slpkg/configs.py @@ -1,7 +1,6 @@ #!/usr/bin/python3 # -*- coding: utf-8 -*- - import os import tomli import platform @@ -9,6 +8,20 @@ import platform from dataclasses import dataclass +class LoadConfigs: + @staticmethod + def file(path: str, file: str) -> dict: + try: + """ Load the configs from the file. """ + config_file: str = f'{path}/{file}.toml' + if os.path.isfile(config_file): + with open(config_file, 'rb') as conf: + return tomli.load(conf) + except (KeyError, tomli.TOMLDecodeError) as error: + raise SystemExit(f"\nError: {error}: in the configuration file " + "'/etc/slpkg/slpkg.toml'\n") + + @dataclass class Configs: """ Default configurations. """ @@ -54,64 +67,56 @@ class Configs: # Dialog utility dialog: str = True - # Overwrite with user configuration. - config_file: str = f'{etc_path}/{prog_name}.toml' - if os.path.isfile(config_file): - with open(config_file, 'rb') as conf: - configs = tomli.load(conf) + load = LoadConfigs() + configs = load.file(etc_path, prog_name) + config = configs['configs'] - try: - config = configs['configs'] + if config: + # OS architecture by default + os_arch: str = config['os_arch'] - # OS architecture by default - os_arch: str = config['os_arch'] + # All necessary paths + tmp_slpkg: str = config['tmp_slpkg'] + build_path: str = config['build_path'] + download_only: str = config['download_only'] + sbo_repo_path: str = config['sbo_repo_path'] - # All necessary paths - tmp_slpkg: str = config['tmp_slpkg'] - build_path: str = config['build_path'] - download_only: str = config['download_only'] - sbo_repo_path: str = config['sbo_repo_path'] + # Database name + database: str = config['database'] - # Database name - database: str = config['database'] + # SBo repository details + sbo_repo_url: str = config['sbo_repo_url'] + sbo_txt: str = config['sbo_txt'] + sbo_chglog_txt: str = config['sbo_chglog_txt'] + sbo_tar_suffix: str = config['sbo_tar_suffix'] + sbo_repo_tag: str = config['sbo_repo_tag'] - # SBo repository details - sbo_repo_url: str = config['sbo_repo_url'] - sbo_txt: str = config['sbo_txt'] - sbo_chglog_txt: str = config['sbo_chglog_txt'] - sbo_tar_suffix: str = config['sbo_tar_suffix'] - sbo_repo_tag: str = config['sbo_repo_tag'] + # Slackware commands + installpkg: str = config['installpkg'] + reinstall: str = config['reinstall'] + removepkg: str = config['removepkg'] - # Slackware commands - installpkg: str = config['installpkg'] - reinstall: str = config['reinstall'] - removepkg: str = config['removepkg'] + # Cli menu colors configs + colors: str = config['colors'] - # Cli menu colors configs - colors: str = config['colors'] + # Wget options + wget_options: str = config['wget_options'] - # Wget options - wget_options: str = config['wget_options'] + # Dialog utility + dialog: str = config['dialog'] - # Dialog utility - dialog: str = config['dialog'] + # Creating the paths if not exists + paths = [tmp_slpkg, + build_path, + download_only, + sbo_repo_path, + lib_path, + etc_path, + db_path] - except KeyError as error: - print(f"Error: {error}: in the configuration file " - "'/etc/slpkg/slpkg.toml'\n") - - # Creating the paths if not exists - paths = [tmp_slpkg, - build_path, - download_only, - sbo_repo_path, - lib_path, - etc_path, - db_path] - - for path in paths: - if not os.path.isdir(path): - os.makedirs(path) + for path in paths: + if not os.path.isdir(path): + os.makedirs(path) @classmethod def colour(cls): diff --git a/slpkg/create_data.py b/slpkg/create_data.py index 46e914fe..6d282cc2 100644 --- a/slpkg/create_data.py +++ b/slpkg/create_data.py @@ -1,7 +1,6 @@ #!/usr/bin/python3 # -*- coding: utf-8 -*- - from slpkg.configs import Configs from slpkg.models.models import SBoTable from slpkg.models.models import session as Session @@ -57,7 +56,7 @@ class CreateData: self.session.commit() @staticmethod - def read_file(file: str): + def read_file(file: str) -> list: """ Reads the text file. """ with open(file, 'r', encoding='utf-8') as f: return f.readlines() diff --git a/slpkg/dependees.py b/slpkg/dependees.py index a387eab7..1408a922 100644 --- a/slpkg/dependees.py +++ b/slpkg/dependees.py @@ -1,7 +1,6 @@ #!/usr/bin/python3 # -*- coding: utf-8 -*- - from slpkg.configs import Configs from slpkg.queries import SBoQueries diff --git a/slpkg/dependencies.py b/slpkg/dependencies.py index c16c5b1b..79be9b1b 100644 --- a/slpkg/dependencies.py +++ b/slpkg/dependencies.py @@ -1,7 +1,6 @@ #!/usr/bin/python3 # -*- coding: utf-8 -*- - from slpkg.queries import SBoQueries diff --git a/slpkg/dialog_box.py b/slpkg/dialog_box.py index 9e976b4a..444af487 100644 --- a/slpkg/dialog_box.py +++ b/slpkg/dialog_box.py @@ -11,15 +11,16 @@ locale.setlocale(locale.LC_ALL, '') class DialogBox: + """ Class for dialog box""" def __init__(self): self.configs = Configs() self.d = Dialog(dialog="dialog") self.d.set_background_title(f'{self.configs.prog_name} {Version().version} - Software Package Manager') - def checklist(self, text, title, height, width, list_height, choices, packages): + def checklist(self, text: str, title: str, height: int, width: int, + list_height: int, choices: list, packages: list): """ Display a checklist box. """ - if self.configs.dialog: code, tags = self.d.checklist(text, title=title, height=height, width=width, list_height=list_height, choices=choices) @@ -28,3 +29,24 @@ class DialogBox: tags = packages return code, tags + + def mixedform(self, text: str, title: str, elements: list, height: int, width: int): + """ Display a mixedform box. """ + if self.configs.dialog: + code, tags = self.d.mixedform(text=text, title=title, elements=elements, + height=height, width=width, help_button=True) + else: + code = False + tags = elements + + return code, tags + + def msgbox(self, text: str, height: int, width: int): + """ Display a message box. """ + if self.configs.dialog: + self.d.msgbox(text, height, width) + + def textbox(self, text: str, height: int, width: int): + """ Display a text box. """ + if self.configs.dialog: + self.d.textbox(text, height, width) diff --git a/slpkg/download_only.py b/slpkg/download_only.py index e30ac419..1708e446 100644 --- a/slpkg/download_only.py +++ b/slpkg/download_only.py @@ -1,7 +1,6 @@ #!/usr/bin/python3 # -*- coding: utf-8 -*- - from slpkg.downloader import Wget from slpkg.configs import Configs from slpkg.queries import SBoQueries diff --git a/slpkg/downloader.py b/slpkg/downloader.py index fc112fa1..e891663c 100644 --- a/slpkg/downloader.py +++ b/slpkg/downloader.py @@ -1,7 +1,6 @@ #!/usr/bin/python3 # -*- coding: utf-8 -*- - import subprocess from slpkg.configs import Configs diff --git a/slpkg/find_installed.py b/slpkg/find_installed.py index 7064c6b6..a6d756de 100644 --- a/slpkg/find_installed.py +++ b/slpkg/find_installed.py @@ -1,7 +1,6 @@ #!/usr/bin/python3 # -*- coding: utf-8 -*- - import os from slpkg.configs import Configs diff --git a/slpkg/form_configs.py b/slpkg/form_configs.py new file mode 100644 index 00000000..0b6572c9 --- /dev/null +++ b/slpkg/form_configs.py @@ -0,0 +1,87 @@ +#!/usr/bin/python3 +# -*- coding: utf-8 -*- + +import os + +from slpkg.configs import Configs +from slpkg.configs import LoadConfigs +from slpkg.dialog_box import DialogBox + + +class FormConfigs: + + def __init__(self): + self.orig_configs = None + self.configs = Configs() + self.load_configs = LoadConfigs() + self.dialog = DialogBox() + self.config_file = f'{self.configs.etc_path}/{self.configs.prog_name}.toml' + + def edit(self): + """ Read and write the configuration file. """ + elements = [] + config_file: str = f'{self.configs.etc_path}/{self.configs.prog_name}.toml' + + if os.path.isfile(config_file): + # Load the toml config file. + configs = self.load_configs.file(self.configs.etc_path, + self.configs.prog_name) + + # Creating the elements for the dialog form. + for i, (key, value) in enumerate(configs['configs'].items(), start=1): + if value is True: + value = 'true' + elif value is False: + value = 'false' + elements += [ + (key, i, 1, value, i, 17, 47, 200, '0x0') + ] + + height = 28 + width = 70 + text = f'Edit the configuration file: {config_file}' + title = ' Configuration File ' + + code, tags = self.dialog.mixedform(text, title, elements, height, width) + + os.system('clear') + + check = self.check_configs(configs, tags) + + if code == 'ok' and check: + self.write_file(configs, tags) + elif not check: + self.edit() + elif code == 'help': + self.help() + + def help(self): + """ Load the configuration file on a text box. """ + self.read_file() + self.dialog.textbox(self.config_file, 40, 60) + self.edit() + + def check_configs(self, configs: dict, tags: list) -> bool: + """ Check for true of false values. """ + for key, value in zip(configs['configs'].keys(), tags): + if key in ['colors', 'dialog'] and value not in ['true', 'false']: + self.dialog.msgbox(f"\nError value for {key}. It must be 'true' or 'false'\n", height=7, width=60) + return False + return True + + def read_file(self): + """ Read the original config file. """ + with open(self.config_file, 'r') as toml_file: + self.orig_configs = toml_file.readlines() + + def write_file(self, configs: dict, tags: list): + """ Write the new values to the config file. """ + self.read_file() + with open(self.config_file, 'w') as patch_toml: + for line in self.orig_configs: + for key, value in zip(configs['configs'].keys(), tags): + if line.lstrip().startswith(key): + line = f' {key} = "{value}"\n' + if line.lstrip().startswith(('colors =', 'dialog =')): + line = line.replace('"', '') + patch_toml.write(line) diff --git a/slpkg/main.py b/slpkg/main.py index 035fb324..5d6b3eef 100644 --- a/slpkg/main.py +++ b/slpkg/main.py @@ -17,6 +17,7 @@ from slpkg.dialog_box import DialogBox from slpkg.views.version import Version from slpkg.download_only import Download from slpkg.slackbuild import Slackbuilds +from slpkg.form_configs import FormConfigs from slpkg.check_updates import CheckUpdates from slpkg.find_installed import FindInstalled from slpkg.views.view_package import ViewPackage @@ -35,6 +36,7 @@ class Argparse: self.utils = Utilities() self.usage = Usage() self.check = Check() + self.form_configs = FormConfigs() if len(self.args) == 0: self.usage.help_short() @@ -49,7 +51,8 @@ class Argparse: self.flag_full_reverse = '--full-reverse' self.flag_search = '--search' - if not self.configs.dialog and self.flag_search in self.args: + if (not self.configs.dialog and self.flag_search in self.args or + not self.configs.dialog and 'configs' in self.args): print("Error: You should enable the dialog " "in the '/etc/slpkg/' folder.\n") self.usage.help(1) @@ -83,25 +86,24 @@ class Argparse: title = f' Choose packages you want to {method} ' repo_packages = SBoQueries('').sbos() - if method == 'remove': + # Grab all the installed packages + installed = os.listdir(self.configs.log_packages) - # Grab all the installed packages - installed = os.listdir(self.configs.log_packages) + if method in ['remove', 'find']: for package in installed: - inst_pkg_name = self.utils.split_installed_pkg(package)[0] + name = self.utils.split_installed_pkg(package)[0] + version = self.utils.split_installed_pkg(package)[1] if package.endswith(self.configs.sbo_repo_tag): for pkg in packages: - if pkg in inst_pkg_name: - repo_ver = SBoQueries(inst_pkg_name).version() - choices += [(inst_pkg_name, repo_ver, False)] + if pkg in name: + choices += [(name, version, False)] else: for package in repo_packages: for pkg in packages: if pkg in package: - repo_ver = SBoQueries(package).version() if method == 'upgrade': @@ -185,6 +187,35 @@ class Argparse: raise SystemExit() self.usage.help(1) + def edit_configs(self): + if len(self.args) == 1 and not self.flags: + self.form_configs.edit() + raise SystemExit() + self.usage.help(1) + + def clean_logs(self): + if [f for f in self.flags if f not in [self.flag_yes]]: + self.usage.help(1) + + if len(self.args) == 1: + self.check.database() + + logs = CleanLogsDependencies(self.flags) + logs.clean() + raise SystemExit() + self.usage.help(1) + + def clean_tmp(self): + if len(self.args) == 1 and not self.flags: + path = self.configs.tmp_path + tmp_slpkg = self.configs.tmp_slpkg + folder = self.configs.prog_name + + self.utils.remove_folder_if_exists(path, folder) + self.utils.create_folder(tmp_slpkg, 'build') + raise SystemExit() + self.usage.help(1) + def build(self): if [f for f in self.flags if f not in [self.flag_yes, self.flag_jobs, @@ -274,9 +305,16 @@ class Argparse: self.usage.help(1) def find(self): - if len(self.args) >= 2 and not self.flags: + if [f for f in self.flags if f not in [self.flag_search]]: + self.usage.help(1) + + if len(self.args) >= 2: packages = list(set(self.args[1:])) + if '--search' in self.flags: + packages = self.choose_packages(packages, + Argparse.find.__name__) + self.check.database() find = FindInstalled() @@ -360,29 +398,6 @@ class Argparse: raise SystemExit() self.usage.help(1) - def clean_logs(self): - if [f for f in self.flags if f not in [self.flag_yes]]: - self.usage.help(1) - - if len(self.args) == 1: - self.check.database() - - logs = CleanLogsDependencies(self.flags) - logs.clean() - raise SystemExit() - self.usage.help(1) - - def clean_tmp(self): - if len(self.args) == 1 and not self.flags: - path = self.configs.tmp_path - tmp_slpkg = self.configs.tmp_slpkg - folder = self.configs.prog_name - - self.utils.remove_folder_if_exists(path, folder) - self.utils.create_folder(tmp_slpkg, 'build') - raise SystemExit() - self.usage.help(1) - def main(): args = sys.argv @@ -398,6 +413,7 @@ def main(): 'update': argparse.update, 'upgrade': argparse.upgrade, 'check-updates': argparse.check_updates, + 'configs': argparse.edit_configs, 'clean-logs': argparse.clean_logs, 'clean-tmp': argparse.clean_tmp, 'build': argparse.build, diff --git a/slpkg/models/models.py b/slpkg/models/models.py index 9beda31f..37f28f86 100644 --- a/slpkg/models/models.py +++ b/slpkg/models/models.py @@ -1,7 +1,6 @@ #!/usr/bin/python3 # -*- coding: utf-8 -*- - from dataclasses import dataclass from sqlalchemy.orm import sessionmaker from sqlalchemy.ext.declarative import declarative_base diff --git a/slpkg/queries.py b/slpkg/queries.py index 5552597b..471bb577 100644 --- a/slpkg/queries.py +++ b/slpkg/queries.py @@ -1,7 +1,6 @@ #!/usr/bin/python3 # -*- coding: utf-8 -*- - from slpkg.configs import Configs from slpkg.blacklist import Blacklist from slpkg.models.models import SBoTable diff --git a/slpkg/search.py b/slpkg/search.py index 4602ecdb..739ddcfd 100644 --- a/slpkg/search.py +++ b/slpkg/search.py @@ -1,7 +1,6 @@ #!/usr/bin/python3 # -*- coding: utf-8 -*- - from slpkg.queries import SBoQueries from slpkg.configs import Configs diff --git a/slpkg/slackbuild.py b/slpkg/slackbuild.py index f125b2df..00991f27 100644 --- a/slpkg/slackbuild.py +++ b/slpkg/slackbuild.py @@ -75,7 +75,7 @@ class Slackbuilds: self.install_order.extend(self.dependencies) - def choose_dependencies(self, dependencies): + def choose_dependencies(self, dependencies: list): """ Choose packages for install. """ height = 10 width = 70 diff --git a/slpkg/tracking.py b/slpkg/tracking.py index f2948c8e..7e6436bf 100644 --- a/slpkg/tracking.py +++ b/slpkg/tracking.py @@ -1,7 +1,6 @@ #!/usr/bin/python3 # -*- coding: utf-8 -*- - from slpkg.configs import Configs from slpkg.dependencies import Requires @@ -13,7 +12,7 @@ class Tracking: self.configs = Configs self.colors = self.configs.colour - def packages(self, packages): + def packages(self, packages: list): """ Prints the packages dependencies. """ color = self.colors() cyan = color['cyan'] diff --git a/slpkg/update_repository.py b/slpkg/update_repository.py index 9c28a096..ac43641d 100644 --- a/slpkg/update_repository.py +++ b/slpkg/update_repository.py @@ -1,7 +1,6 @@ #!/usr/bin/python3 # -*- coding: utf-8 -*- - import os from os import path @@ -18,7 +17,7 @@ from slpkg.models.models import session as Session class UpdateRepository: """ Deletes and install the data. """ - def __init__(self, flags): + def __init__(self, flags: list): self.flags = flags self.configs = Configs self.session = Session diff --git a/slpkg/utilities.py b/slpkg/utilities.py index eb6db319..625cb602 100644 --- a/slpkg/utilities.py +++ b/slpkg/utilities.py @@ -1,8 +1,8 @@ #!/usr/bin/python3 # -*- coding: utf-8 -*- - import os +import tomli import shutil import tarfile @@ -22,6 +22,7 @@ class Utilities: pkg = self.split_installed_pkg(package)[0] if pkg == name and self.configs.sbo_repo_tag in package and pkg not in self.black.get(): return package + return '' @staticmethod def untar_archive(path: str, archive: str, ext_path: str): diff --git a/slpkg/views/cli_menu.py b/slpkg/views/cli_menu.py index 9e39d341..c8454b93 100644 --- a/slpkg/views/cli_menu.py +++ b/slpkg/views/cli_menu.py @@ -1,7 +1,6 @@ #!/usr/bin/python3 # -*- coding: utf-8 -*- - from slpkg.configs import Configs @@ -21,12 +20,13 @@ class Usage: """ Prints the short menu. """ args = ( f'Usage: {Configs.prog_name} [{self.yellow}OPTIONS{self.endc}] [{self.cyan}COMMAND{self.endc}] \n' - f'\n slpkg [{self.yellow}OPTIONS{self.endc}] [--yes, --jobs, --resolve-off, --reinstall]\n' - f' slpkg [{self.yellow}OPTIONS{self.endc}] [--skip-installed, --full-reverse, --search]\n' - f' slpkg [{self.cyan}COMMAND{self.endc}] [update, upgrade, check-updates, clean-logs, clean-tmp]\n' + f'\n slpkg [{self.cyan}COMMAND{self.endc}] [update, upgrade, check-updates, configs]\n' + f' slpkg [{self.cyan}COMMAND{self.endc}] [clean-logs, clean-tmp]\n' f' slpkg [{self.cyan}COMMAND{self.endc}] [-b, build, -i, install, -d, download, -r, remove] \n' f' slpkg [{self.cyan}COMMAND{self.endc}] [-f, find, -w, view, -s, search, -e, dependees] \n' f' slpkg [{self.cyan}COMMAND{self.endc}] [-t, tracking] \n' + f' slpkg [{self.yellow}OPTIONS{self.endc}] [--yes, --jobs, --resolve-off, --reinstall]\n' + f' slpkg [{self.yellow}OPTIONS{self.endc}] [--skip-installed, --full-reverse, --search]\n' " \nIf you need more information please try 'slpkg --help'.") print(args) @@ -42,6 +42,7 @@ class Usage: f' {self.red}update{self.endc} Update the package lists.\n' f' {self.cyan}upgrade{self.endc} Upgrade all the packages.\n' f' {self.cyan}check-updates{self.endc} Check for news on ChangeLog.txt.\n' + f' {self.cyan}configs{self.endc} Edit the configuration file.\n' f' {self.cyan}clean-logs{self.endc} Clean dependencies log tracking.\n' f' {self.cyan}clean-tmp{self.endc} Delete all the downloaded sources.\n' f' {self.cyan}-b, build{self.endc} Build only the packages.\n' @@ -63,7 +64,8 @@ class Usage: f' {self.yellow}--search{self.endc} Search packages from the repository.\n' '\n -h, --help Show this message and exit.\n' ' -v, --version Print version and exit.\n' - '\nEdit the configuration file in the /etc/slpkg/slpkg.toml.\n' + '\nEdit the configuration file in the /etc/slpkg/slpkg.toml \n' + "or run 'slpkg configs'.\n" 'If you need more information try to use slpkg manpage.') print(args) diff --git a/slpkg/views/version.py b/slpkg/views/version.py index 91ad52a7..5fbde9d7 100644 --- a/slpkg/views/version.py +++ b/slpkg/views/version.py @@ -1,12 +1,11 @@ #!/usr/bin/python3 # -*- coding: utf-8 -*- - class Version: """ Print the version. """ def __init__(self): - self.version_info = (4, 4, 0) + self.version_info = (4, 4, 1) self.version = '{0}.{1}.{2}'.format(*self.version_info) self.license = 'MIT License' self.author = 'Dimitris Zlatanidis (dslackw)' diff --git a/slpkg/views/view_package.py b/slpkg/views/view_package.py index 238ba2cf..a33910fb 100644 --- a/slpkg/views/view_package.py +++ b/slpkg/views/view_package.py @@ -1,7 +1,6 @@ #!/usr/bin/python3 # -*- coding: utf-8 -*- - import urllib3 from slpkg.configs import Configs diff --git a/slpkg/views/views.py b/slpkg/views/views.py index 3e3f3805..9935bfdb 100644 --- a/slpkg/views/views.py +++ b/slpkg/views/views.py @@ -2,6 +2,7 @@ # -*- coding: utf-8 -*- import os +from typing import Any from slpkg.configs import Configs from slpkg.queries import SBoQueries @@ -65,7 +66,7 @@ class ViewMessage: version = SBoQueries(sbo).version() self._view_download(sbo, version) - def remove_packages(self, packages: list): + def remove_packages(self, packages: list) -> Any: """ View remove packages. """ slackbuilds, dependencies, deps = [], [], [] for pkg in packages: @@ -100,7 +101,7 @@ class ViewMessage: return self.installed_packages, dependencies - def choose_dependencies_for_remove(self, dependencies): + def choose_dependencies_for_remove(self, dependencies: list) -> list: """ Choose packages for remove. """ height = 10 width = 70