From db5eeabfb89a972fe85f42fb3aa838eda46c348b Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Thu, 17 Jun 2021 17:03:34 -0300 Subject: [PATCH 01/10] [arch] fix: some dependencies not being matched during comparisons between numeric and alphanumeric versions --- CHANGELOG.md | 6 +++++ bauh/__init__.py | 2 +- bauh/gems/arch/dependencies.py | 35 +++++++++---------------- bauh/gems/arch/mapper.py | 26 ++----------------- bauh/gems/arch/updates.py | 7 ++--- bauh/gems/arch/version.py | 35 +++++++++++++++++++++++++ tests/common/__init__.py | 0 tests/gems/arch/test_version.py | 46 +++++++++++++++++++++++++++++++++ 8 files changed, 104 insertions(+), 53 deletions(-) create mode 100644 bauh/gems/arch/version.py create mode 100644 tests/common/__init__.py create mode 100644 tests/gems/arch/test_version.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 92d8c90f3..38d117724 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +## [0.9.18] +### Fixes +- Arch + - install/upgrade/downgrade: some dependencies not being matched during comparisons between numeric and alphanumeric versions + + ## [0.9.17] 2021-06-16 ### Improvements - general: replacing subprocess commands to detect installed CLIs by Python faster calls (**shutil.which**) diff --git a/bauh/__init__.py b/bauh/__init__.py index 5b6bb8294..1cf69e8da 100644 --- a/bauh/__init__.py +++ b/bauh/__init__.py @@ -1,4 +1,4 @@ -__version__ = '0.9.17' +__version__ = '0.9.18' __app_name__ = 'bauh' import os diff --git a/bauh/gems/arch/dependencies.py b/bauh/gems/arch/dependencies.py index 66ebe8ad6..53289679b 100644 --- a/bauh/gems/arch/dependencies.py +++ b/bauh/gems/arch/dependencies.py @@ -3,13 +3,11 @@ from threading import Thread from typing import Set, List, Tuple, Dict, Iterable, Optional -from packaging.version import parse as parse_version - from bauh.api.abstract.handler import ProcessWatcher from bauh.gems.arch import pacman, message, sorting, confirmation from bauh.gems.arch.aur import AURClient from bauh.gems.arch.exceptions import PackageNotFoundException -from bauh.gems.arch.util import clean_version +from bauh.gems.arch.version import compare_versions from bauh.view.util.translation import I18n @@ -220,7 +218,7 @@ def _fill_missing_dep(self, dep_name: str, dep_exp: str, aur_index: Iterable[str matched_providers = set() split_informed_dep = self.re_dep_operator.split(dep_exp) try: - version_required = parse_version(clean_version(split_informed_dep[2])) + version_required = split_informed_dep[2] exp_op = split_informed_dep[1] if split_informed_dep[1] != '=' else '==' for p in providers: @@ -230,9 +228,9 @@ def _fill_missing_dep(self, dep_name: str, dep_exp: str, aur_index: Iterable[str split_dep = self.re_dep_operator.split(provided_exp) if len(split_dep) == 3 and split_dep[0] == dep_name: - version_provided = parse_version(clean_version(split_dep[2])) + version_provided = split_dep[2] - if eval('version_provided {} version_required'.format(exp_op)): + if compare_versions(version_provided, exp_op, version_required): matched_providers.add(p) break @@ -270,17 +268,17 @@ def _fill_missing_dep(self, dep_name: str, dep_exp: str, aur_index: Iterable[str self.__raise_dependency_not_found(dep_exp, watcher) else: try: - dep_version = parse_version(clean_version(dep_info[0]['Version'])) + dep_version = dep_info[0]['Version'] except: traceback.print_exc() - self.__raise_dependency_not_found(dep_exp, watcher) + return self.__raise_dependency_not_found(dep_exp, watcher) split_informed_dep = self.re_dep_operator.split(dep_exp) try: - version_required = parse_version(clean_version(split_informed_dep[2])) + version_required = split_informed_dep[2] exp_op = split_informed_dep[1] if split_informed_dep[1] != '=' else '==' - if eval('dep_version {} version_required'.format(exp_op)): + if compare_versions(dep_version, exp_op, version_required): aur_deps.add(dep_name) missing_deps.add((dep_name, 'aur')) except: @@ -334,20 +332,11 @@ def map_missing_deps(self, pkgs_data: Dict[str, dict], provided_map: Dict[str, S version_found = [p for p in provided_map if p.startswith(version_pattern)] if version_found: - version_found = clean_version(version_found[0].split('=')[1]) - version_required = clean_version(dep_split[2]) - - try: - version_found = parse_version(version_found) - version_required = parse_version(version_required) - - op = dep_split[1] if dep_split[1] != '=' else '==' - match = eval('version_found {} version_required'.format(op)) - except: - match = False - traceback.print_exc() + version_found = version_found[0].split('=')[1] + version_required = dep_split[2] + op = dep_split[1] if dep_split[1] != '=' else '==' - if not match: + if not compare_versions(version_found, op, version_required): self._fill_missing_dep(dep_name=dep_name, dep_exp=dep, aur_index=aur_index, missing_deps=missing_deps, remote_provided_map=remote_provided_map, diff --git a/bauh/gems/arch/mapper.py b/bauh/gems/arch/mapper.py index 3d363a734..30b114250 100644 --- a/bauh/gems/arch/mapper.py +++ b/bauh/gems/arch/mapper.py @@ -1,14 +1,11 @@ import logging import os -import traceback from typing import Optional -from colorama import Fore -from packaging.version import parse as parse_version - from bauh.api.abstract.model import PackageStatus from bauh.api.http import HttpClient from bauh.gems.arch.model import ArchPackage +from bauh.gems.arch.version import compare_versions from bauh.view.util.translation import I18n URL_PKG_DOWNLOAD = 'https://aur.archlinux.org/{}' @@ -64,26 +61,7 @@ def fill_api_data(self, pkg: ArchPackage, api_data: dict, fill_version: bool = T @staticmethod def check_version_update(version: str, latest_version: str) -> bool: if version and latest_version and version != latest_version: - try: - ver_epoch, latest_epoch = version.split(':'), latest_version.split(':') - - if len(ver_epoch) > 1 and len(latest_epoch) > 1: - parsed_ver_epoch, parsed_latest_epoch = parse_version(ver_epoch[0]), parse_version(latest_epoch[0]) - - if parsed_ver_epoch == parsed_latest_epoch: - return parse_version(''.join(ver_epoch[1:])) < parse_version(''.join(latest_epoch[1:])) - else: - return parsed_ver_epoch < parsed_latest_epoch - elif len(ver_epoch) > 1 and len(latest_epoch) == 1: - return False - elif len(ver_epoch) == 1 and len(latest_epoch) > 1: - return True - else: - return parse_version(version) < parse_version(latest_version) - except: - print('{}Version: {}. Latest version: {}{}'.format(Fore.RED, version, latest_version, Fore.RESET)) - traceback.print_exc() - return False + return compare_versions(latest_version, '>', version) return False diff --git a/bauh/gems/arch/updates.py b/bauh/gems/arch/updates.py index 77db6c80c..347b6714f 100644 --- a/bauh/gems/arch/updates.py +++ b/bauh/gems/arch/updates.py @@ -4,8 +4,6 @@ from threading import Thread from typing import Dict, Set, List, Tuple, Iterable, Optional -from packaging.version import parse as parse_version - from bauh.api.abstract.controller import UpgradeRequirements, UpgradeRequirement from bauh.api.abstract.handler import ProcessWatcher from bauh.gems.arch import pacman, sorting @@ -14,6 +12,7 @@ from bauh.gems.arch.exceptions import PackageNotFoundException from bauh.gems.arch.model import ArchPackage from bauh.gems.arch.pacman import RE_DEP_OPERATORS +from bauh.gems.arch.version import compare_versions from bauh.view.util.translation import I18n @@ -733,9 +732,7 @@ def _add_dependency_breakage(self, pkgname: str, pkgdeps: Optional[Set[str]], pr for v in versions: try: - provided_version, required_version = parse_version(v), parse_version(dep_split[1]) - - if eval('provided_version {} required_version'.format(op)): + if compare_versions(v, op, dep_split[1]): version_match = True break except: diff --git a/bauh/gems/arch/version.py b/bauh/gems/arch/version.py new file mode 100644 index 000000000..cf4574d42 --- /dev/null +++ b/bauh/gems/arch/version.py @@ -0,0 +1,35 @@ +from typing import Optional + +from packaging.version import parse + + +def normalize_version(version: str) -> Optional[str]: + if version: + final_version = version.strip() + + if final_version: + if ':' not in final_version: + final_version = '0:{}'.format(final_version) + + if '-' not in final_version: + final_version = '{}-1'.format(final_version) + + return final_version + + +def compare_versions(version_a: str, operator: str, version_b: str) -> bool: + if operator: + a_obj, b_obj = parse(normalize_version(version_a)), parse(normalize_version(version_b)) + + if operator == '>': + return a_obj > b_obj + elif operator == '>=': + return a_obj >= b_obj + elif operator == '<': + return a_obj < b_obj + elif operator == '<=': + return a_obj <= b_obj + elif operator == '==': + return a_obj == b_obj + + raise Exception("compare: invalid string operator {}".format(operator)) diff --git a/tests/common/__init__.py b/tests/common/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/gems/arch/test_version.py b/tests/gems/arch/test_version.py new file mode 100644 index 000000000..7a8e2017b --- /dev/null +++ b/tests/gems/arch/test_version.py @@ -0,0 +1,46 @@ +from unittest import TestCase + +from bauh.gems.arch import version + + +class CompareVersionsTest(TestCase): + + def test_both_versions_only_filled_with_numbers_and_same_number_of_divisions(self): + self.assertFalse(version.compare_versions('1', '>', '2')) + self.assertTrue(version.compare_versions('1', '<', '2')) + self.assertTrue(version.compare_versions('1', '<=', '2')) + self.assertTrue(version.compare_versions('2', '>=', '1')) + self.assertTrue(version.compare_versions('1', '==', '1')) + self.assertFalse(version.compare_versions('1.1', '>', '2.0')) + self.assertTrue(version.compare_versions('1.1', '<', '2.0')) + self.assertTrue(version.compare_versions('1.1', '<=', '2.0')) + self.assertTrue(version.compare_versions('2.1', '>', '2.0')) + self.assertTrue(version.compare_versions('2.1', '>=', '2.0')) + self.assertTrue(version.compare_versions('2.0', '==', '2.0')) + + def test_versions_only_filled_with_numbers_and_different_number_of_divisons(self): + self.assertFalse(version.compare_versions('1.0', '>', '2')) + self.assertTrue(version.compare_versions('1', '<', '2.0')) + self.assertTrue(version.compare_versions('1.1.1', '<=', '2')) + self.assertTrue(version.compare_versions('2', '>=', '1.0')) + self.assertTrue(version.compare_versions('1.0', '==', '1')) + self.assertTrue(version.compare_versions('1.1', '>', '1')) + self.assertFalse(version.compare_versions('1.1', '<', '1')) + + def test_one_version_contain_mixed_letters_and_symbols(self): + self.assertTrue(version.compare_versions('2.3.3op2', '>=', '2.2.6')) + self.assertTrue(version.compare_versions('2.2a', '<', '2.2b')) + self.assertTrue(version.compare_versions('2.2a', '<', '2.3a')) + + def test_versions_with_epochs(self): + self.assertTrue(version.compare_versions('1:1', '==', '1:1.0')) + self.assertTrue(version.compare_versions('1:1', '<', '1:1.1')) + self.assertTrue(version.compare_versions('1:1', '<=', '1:1.1')) + self.assertTrue(version.compare_versions('2:0', '>', '1:1.1')) + self.assertTrue(version.compare_versions('1:0', '>', '2.0-1')) + + def test_versions_with_release_number(self): + self.assertTrue(version.compare_versions('1.0-1', '<', '1.0-2')) + self.assertTrue(version.compare_versions('1.0-2', '>', '1.0-1')) + self.assertTrue(version.compare_versions('1.0-1', '<', '1.0-10')) + self.assertTrue(version.compare_versions('1.0-10', '>', '1.0-1')) From 1e1b1dc864b5268404e4c1a3d619d1dc2de5684c Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Thu, 17 Jun 2021 17:07:26 -0300 Subject: [PATCH 02/10] tests: filtering some wrong warnings --- tests/gems/arch/test_pacman.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/gems/arch/test_pacman.py b/tests/gems/arch/test_pacman.py index ea7e2c255..f339313d5 100644 --- a/tests/gems/arch/test_pacman.py +++ b/tests/gems/arch/test_pacman.py @@ -1,4 +1,5 @@ import os +import warnings from unittest import TestCase from bauh.gems.arch import pacman @@ -8,6 +9,10 @@ class PacmanTest(TestCase): + @classmethod + def setUpClass(cls): + warnings.filterwarnings('ignore') + def test_list_ignored_packages(self): ignored = pacman.list_ignored_packages(FILE_DIR + '/resources/pacman_ign_pkgs.conf') From 476a30c9f4dc4d25e9dc752caa2291ab33791bd5 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Thu, 17 Jun 2021 17:28:29 -0300 Subject: [PATCH 03/10] [arch] improvmenet -> cleaning up some code warnings --- bauh/api/abstract/download.py | 4 ++-- bauh/gems/arch/aur.py | 2 +- bauh/gems/arch/confirmation.py | 6 +++--- bauh/gems/arch/controller.py | 16 +++++----------- bauh/gems/arch/dependencies.py | 5 ++--- bauh/gems/arch/pacman.py | 12 ++++++------ bauh/gems/arch/sorting.py | 4 ++-- bauh/gems/arch/updates.py | 2 +- bauh/gems/arch/util.py | 2 +- 9 files changed, 23 insertions(+), 30 deletions(-) diff --git a/bauh/api/abstract/download.py b/bauh/api/abstract/download.py index f9359198b..5b54e5896 100644 --- a/bauh/api/abstract/download.py +++ b/bauh/api/abstract/download.py @@ -1,5 +1,5 @@ from abc import ABC, abstractmethod -from typing import Iterable, List +from typing import Iterable, List, Optional from bauh.api.abstract.handler import ProcessWatcher @@ -7,7 +7,7 @@ class FileDownloader(ABC): @abstractmethod - def download(self, file_url: str, watcher: ProcessWatcher, output_path: str, cwd: str, root_password: str = None, substatus_prefix: str = None, display_file_size: bool = True, max_threads: int = None, known_size: int = None) -> bool: + def download(self, file_url: str, watcher: Optional[ProcessWatcher], output_path: str, cwd: str, root_password: str = None, substatus_prefix: str = None, display_file_size: bool = True, max_threads: int = None, known_size: int = None) -> bool: """ :param file_url: :param watcher: diff --git a/bauh/gems/arch/aur.py b/bauh/gems/arch/aur.py index 0d53eb15b..d002dc282 100644 --- a/bauh/gems/arch/aur.py +++ b/bauh/gems/arch/aur.py @@ -233,7 +233,7 @@ def read_index(self) -> Iterable[str]: def clean_caches(self): self.srcinfo_cache.clear() - def map_update_data(self, pkgname: str, latest_version: str, srcinfo: dict = None) -> dict: + def map_update_data(self, pkgname: str, latest_version: Optional[str], srcinfo: Optional[dict] = None) -> dict: info = self.get_src_info(pkgname) if not srcinfo else srcinfo provided = set() diff --git a/bauh/gems/arch/confirmation.py b/bauh/gems/arch/confirmation.py index 1cea016eb..544e04383 100644 --- a/bauh/gems/arch/confirmation.py +++ b/bauh/gems/arch/confirmation.py @@ -1,4 +1,4 @@ -from typing import Set, List, Tuple, Dict +from typing import Set, List, Tuple, Dict, Optional from bauh.api.abstract.handler import ProcessWatcher from bauh.api.abstract.view import MultipleSelectComponent, InputOption, FormComponent, SingleSelectComponent, \ @@ -44,7 +44,7 @@ def request_optional_deps(pkgname: str, pkg_repos: dict, watcher: ProcessWatcher return {o.value for o in view_opts.values} -def request_install_missing_deps(pkgname: str, deps: List[Tuple[str, str]], watcher: ProcessWatcher, i18n: I18n) -> bool: +def request_install_missing_deps(pkgname: Optional[str], deps: List[Tuple[str, str]], watcher: ProcessWatcher, i18n: I18n) -> bool: msg = '

{}

'.format(i18n['arch.missing_deps.body'].format(name=bold(pkgname) if pkgname else '', deps=bold(str(len(deps))))) opts = [] @@ -101,4 +101,4 @@ def request_providers(providers_map: Dict[str, Set[str]], repo_map: Dict[str, st confirmation_label=i18n['proceed'].capitalize(), deny_label=i18n['cancel'].capitalize()): - return {s.get_selected() for s in form.components} + return {s.get_selected() for s in form.components if isinstance(s, SingleSelectComponent)} diff --git a/bauh/gems/arch/controller.py b/bauh/gems/arch/controller.py index 04f0d8fd2..c9bdf3ced 100644 --- a/bauh/gems/arch/controller.py +++ b/bauh/gems/arch/controller.py @@ -11,7 +11,7 @@ from math import floor from pathlib import Path from threading import Thread -from typing import List, Set, Type, Tuple, Dict, Iterable, Optional +from typing import List, Set, Type, Tuple, Dict, Iterable, Optional, Collection import requests from dateutil.parser import parse as parse_date @@ -927,7 +927,7 @@ def _map_dependencies_breakage(self, output: str) -> List[ViewComponent]: else: return [TextComponent(output)] - def list_related(self, pkgs: Iterable[str], all_pkgs: Iterable[str], data: Dict[str, dict], related: Set[str], provided_map: Dict[str, Set[str]]) -> Set[str]: + def list_related(self, pkgs: Collection[str], all_pkgs: Collection[str], data: Dict[str, dict], related: Set[str], provided_map: Dict[str, Set[str]]) -> Set[str]: related.update(pkgs) deps = set() @@ -1261,7 +1261,7 @@ def _uninstall_pkgs(self, pkgs: Iterable[str], root_password: str, handler: Proc return all_uninstalled - def _request_uninstall_confirmation(self, to_uninstall: Iterable[str], required: Iterable[str], watcher: ProcessWatcher) -> bool: + def _request_uninstall_confirmation(self, to_uninstall: Collection[str], required: Collection[str], watcher: ProcessWatcher) -> bool: reqs = [InputOption(label=p, value=p, icon_path=get_icon_path(), read_only=True) for p in required] reqs_select = MultipleSelectComponent(options=reqs, default_options=set(reqs), label="", max_per_line=1 if len(reqs) < 4 else 3) @@ -1291,7 +1291,7 @@ def _request_unncessary_uninstall_confirmation(self, unnecessary: Iterable[str], window_cancel=False): return {*reqs_select.get_selected_values()} - def _request_all_unncessary_uninstall_confirmation(self, pkgs: Iterable[str], context: TransactionContext): + def _request_all_unncessary_uninstall_confirmation(self, pkgs: Collection[str], context: TransactionContext): reqs = [InputOption(label=p, value=p, icon_path=get_icon_path(), read_only=True) for p in pkgs] reqs_select = MultipleSelectComponent(options=reqs, default_options=set(reqs), label="", max_per_line=1) @@ -1738,12 +1738,6 @@ def _request_conflict_resolution(self, pkg: str, conflicting_pkg: str, context: return res def _install_deps(self, context: TransactionContext, deps: List[Tuple[str, str]]) -> Iterable[str]: - """ - :param pkgs_repos: - :param root_password: - :param handler: - :return: not installed dependency - """ progress_increment = int(100 / len(deps)) progress = 0 self._update_progress(context, 1) @@ -1820,7 +1814,7 @@ def _install_deps(self, context: TransactionContext, deps: List[Tuple[str, str]] self._update_progress(context, 100) - def _map_repos(self, pkgnames: Iterable[str]) -> dict: + def _map_repos(self, pkgnames: Collection[str]) -> dict: pkg_repos = pacman.get_repositories(pkgnames) # getting repositories set if len(pkgnames) != len(pkg_repos): # checking if any dep not found in the distro repos are from AUR diff --git a/bauh/gems/arch/dependencies.py b/bauh/gems/arch/dependencies.py index 53289679b..67f3c4103 100644 --- a/bauh/gems/arch/dependencies.py +++ b/bauh/gems/arch/dependencies.py @@ -138,8 +138,7 @@ def get_missing_subdeps(self, name: str, repository: str, srcinfo: dict = None) return missing return missing - def map_known_missing_deps(self, known_deps: Dict[str, str], watcher: ProcessWatcher, check_subdeps: bool = True) -> \ - List[Tuple[str, str]]: + def map_known_missing_deps(self, known_deps: Dict[str, str], watcher: ProcessWatcher, check_subdeps: bool = True) -> Optional[List[Tuple[str, str]]]: sorted_deps = [] # it will hold the proper order to install the missing dependencies repo_deps, aur_deps = set(), set() @@ -411,7 +410,7 @@ def fill_providers_deps(self, missing_deps: List[Tuple[str, str]], provided_map: Dict[str, Set[str]], remote_repo_map: Dict[str, str], already_checked: Set[str], remote_provided_map: Dict[str, Set[str]], deps_data: Dict[str, dict], aur_idx: Iterable[str], sort: bool, - watcher: ProcessWatcher, automatch_providers: bool) -> List[Tuple[str, str]]: + watcher: ProcessWatcher, automatch_providers: bool) -> Optional[List[Tuple[str, str]]]: """ :param missing_deps: :param provided_map: diff --git a/bauh/gems/arch/pacman.py b/bauh/gems/arch/pacman.py index cd528dfa4..c7f261686 100644 --- a/bauh/gems/arch/pacman.py +++ b/bauh/gems/arch/pacman.py @@ -12,13 +12,13 @@ from bauh.commons.util import size_to_byte from bauh.gems.arch.exceptions import PackageNotFoundException, PackageInHoldException -RE_DEPS = re.compile(r'[\w\-_]+:[\s\w_\-\.]+\s+\[\w+\]') -RE_OPTDEPS = re.compile(r'[\w\._\-]+\s*:') +RE_DEPS = re.compile(r'[\w\-_]+:[\s\w_\-.]+\s+\[\w+]') +RE_OPTDEPS = re.compile(r'[\w._\-]+\s*:') RE_DEP_NOTFOUND = re.compile(r'error:.+\'(.+)\'') RE_DEP_OPERATORS = re.compile(r'[<>=]') RE_INSTALLED_FIELDS = re.compile(r'(Name|Description|Version|Install Date|Validated By)\s*:\s*(.+)') -RE_INSTALLED_SIZE = re.compile(r'Installed Size\s*:\s*([0-9,\.]+)\s(\w+)\n?', re.IGNORECASE) -RE_DOWNLOAD_SIZE = re.compile(r'Download Size\s*:\s*([0-9,\.]+)\s(\w+)\n?', re.IGNORECASE) +RE_INSTALLED_SIZE = re.compile(r'Installed Size\s*:\s*([0-9,.]+)\s(\w+)\n?', re.IGNORECASE) +RE_DOWNLOAD_SIZE = re.compile(r'Download Size\s*:\s*([0-9,.]+)\s(\w+)\n?', re.IGNORECASE) RE_UPDATE_REQUIRED_FIELDS = re.compile(r'(\bProvides\b|\bInstalled Size\b|\bConflicts With\b)\s*:\s(.+)\n') RE_REMOVE_TRANSITIVE_DEPS = re.compile(r'removing\s([\w\-_]+)\s.+required\sby\s([\w\-_]+)\n?') RE_AVAILABLE_MIRRORS = re.compile(r'.+\s+OK\s+.+\s+(\d+:\d+)\s+.+(http.+)') @@ -251,7 +251,7 @@ def check_missing(names: Set[str]) -> Set[str]: return not_installed -def read_repository_from_info(name: str) -> str: +def read_repository_from_info(name: str) -> Optional[str]: info = new_subprocess(['pacman', '-Si', name]) not_found = False @@ -459,7 +459,7 @@ def get_databases() -> Set[str]: with open('/etc/pacman.conf') as f: conf_str = f.read() - return {db for db in re.findall(r'[\n|\s]+\[(\w+)\]', conf_str) if db != 'options'} + return {db for db in re.findall(r'[\n|\s]+\[(\w+)]', conf_str) if db != 'options'} def can_refresh_mirrors() -> bool: diff --git a/bauh/gems/arch/sorting.py b/bauh/gems/arch/sorting.py index 5ccd4fe8f..ee0997347 100644 --- a/bauh/gems/arch/sorting.py +++ b/bauh/gems/arch/sorting.py @@ -1,4 +1,4 @@ -from typing import Dict, Set, Iterable, Tuple, List +from typing import Dict, Set, Tuple, List, Collection def __add_dep_to_sort(pkgname: str, pkgs_data: Dict[str, dict], sorted_names: dict, not_sorted: Set[str], @@ -35,7 +35,7 @@ def __add_dep_to_sort(pkgname: str, pkgs_data: Dict[str, dict], sorted_names: di return idx -def sort(pkgs: Iterable[str], pkgs_data: Dict[str, dict], provided_map: Dict[str, Set[str]] = None) -> List[Tuple[str, str]]: +def sort(pkgs: Collection[str], pkgs_data: Dict[str, dict], provided_map: Dict[str, Set[str]] = None) -> List[Tuple[str, str]]: sorted_list, sorted_names, not_sorted = [], set(), set() provided = provided_map if provided_map else {} diff --git a/bauh/gems/arch/updates.py b/bauh/gems/arch/updates.py index 347b6714f..7a62eafbe 100644 --- a/bauh/gems/arch/updates.py +++ b/bauh/gems/arch/updates.py @@ -366,7 +366,7 @@ def _map_requirement(self, pkg: ArchPackage, context: UpdateRequirementsContext, return requirement - def summarize(self, pkgs: List[ArchPackage], root_password: str, arch_config: dict) -> UpgradeRequirements: + def summarize(self, pkgs: List[ArchPackage], root_password: str, arch_config: dict) -> Optional[UpgradeRequirements]: res = UpgradeRequirements([], [], [], []) remote_provided_map = pacman.map_provided(remote=True) diff --git a/bauh/gems/arch/util.py b/bauh/gems/arch/util.py index 96edb3805..8785606e4 100644 --- a/bauh/gems/arch/util.py +++ b/bauh/gems/arch/util.py @@ -1,7 +1,7 @@ import re RE_STRIP_EPIC = re.compile(r'^\d+:') -RE_STRIP_RELEASE = re.compile(r'-[\d\.?]+$') +RE_STRIP_RELEASE = re.compile(r'-[\d.?]+$') def clean_version(version: str) -> str: From 37ec3d96f45d3ae5dc6b2a7395eb1d8dc2d0efa0 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Thu, 17 Jun 2021 17:31:09 -0300 Subject: [PATCH 04/10] tests: cleaning up some warnings --- tests/gems/arch/test_aur_data_mapper.py | 5 +++++ tests/gems/arch/test_version.py | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/tests/gems/arch/test_aur_data_mapper.py b/tests/gems/arch/test_aur_data_mapper.py index 6e643f845..47c01bef2 100644 --- a/tests/gems/arch/test_aur_data_mapper.py +++ b/tests/gems/arch/test_aur_data_mapper.py @@ -1,3 +1,4 @@ +import warnings from unittest import TestCase from unittest.mock import Mock @@ -7,6 +8,10 @@ class ArchDataMapperTest(TestCase): + @classmethod + def setUpClass(cls): + warnings.filterwarnings('ignore') + def test_check_version_update(self): self.assertTrue(AURDataMapper.check_version_update('1.0.0-1', '1.0.0-2')) self.assertFalse(AURDataMapper.check_version_update('1.0.0-2', '1.0.0-1')) diff --git a/tests/gems/arch/test_version.py b/tests/gems/arch/test_version.py index 7a8e2017b..435ae3444 100644 --- a/tests/gems/arch/test_version.py +++ b/tests/gems/arch/test_version.py @@ -1,3 +1,4 @@ +import warnings from unittest import TestCase from bauh.gems.arch import version @@ -5,6 +6,10 @@ class CompareVersionsTest(TestCase): + @classmethod + def setUpClass(cls): + warnings.filterwarnings('ignore') + def test_both_versions_only_filled_with_numbers_and_same_number_of_divisions(self): self.assertFalse(version.compare_versions('1', '>', '2')) self.assertTrue(version.compare_versions('1', '<', '2')) From 6e2a4222c8133431be1c867e684248bfa89255e7 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Thu, 17 Jun 2021 17:46:13 -0300 Subject: [PATCH 05/10] [arch] refactoring: removing unneeded module --- bauh/gems/arch/util.py | 12 ------------ tests/gems/arch/test_util.py | 27 --------------------------- 2 files changed, 39 deletions(-) delete mode 100644 bauh/gems/arch/util.py delete mode 100644 tests/gems/arch/test_util.py diff --git a/bauh/gems/arch/util.py b/bauh/gems/arch/util.py deleted file mode 100644 index 8785606e4..000000000 --- a/bauh/gems/arch/util.py +++ /dev/null @@ -1,12 +0,0 @@ -import re - -RE_STRIP_EPIC = re.compile(r'^\d+:') -RE_STRIP_RELEASE = re.compile(r'-[\d.?]+$') - - -def clean_version(version: str) -> str: - treated_version = version.strip() - if treated_version: - return RE_STRIP_RELEASE.split(RE_STRIP_EPIC.split(treated_version)[-1])[0] - - return treated_version diff --git a/tests/gems/arch/test_util.py b/tests/gems/arch/test_util.py deleted file mode 100644 index 55175b821..000000000 --- a/tests/gems/arch/test_util.py +++ /dev/null @@ -1,27 +0,0 @@ -from unittest import TestCase - -from bauh.gems.arch.util import clean_version - - -class TestUtil(TestCase): - - def test_clean_version__blank_version(self): - self.assertEqual('', clean_version('')) - - def test_clean_version__blank_version_with_several_spaces(self): - self.assertEqual('', clean_version(' ')) - - def test_clean_version__with_epic(self): - self.assertEqual('12.0.0', clean_version('1:12.0.0')) - - def test_clean_version__with_release(self): - self.assertEqual('12.0.0', clean_version('12.0.0-1')) - - def test_clean_version__with_epic_and_release(self): - self.assertEqual('12.0.0', clean_version('1:12.0.0-2')) - - def test_clean_version__with_several_releases(self): - self.assertEqual('12.0.0-1-2', clean_version('12.0.0-1-2-3')) - - def test_clean_version__(self): - self.assertEqual('29', clean_version('29-1.0')) From c2493befda2493cda5d671ad7777d36646ad85e9 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Fri, 18 Jun 2021 15:14:20 -0300 Subject: [PATCH 06/10] [arch] fix -> regressions from commit db5eeabf --- bauh/gems/arch/dependencies.py | 12 ++-- bauh/gems/arch/mapper.py | 4 +- bauh/gems/arch/updates.py | 7 +- bauh/gems/arch/version.py | 66 +++++++++++------- tests/gems/arch/test_aur_data_mapper.py | 16 ++++- tests/gems/arch/test_version.py | 91 +++++++++++++------------ 6 files changed, 115 insertions(+), 81 deletions(-) diff --git a/bauh/gems/arch/dependencies.py b/bauh/gems/arch/dependencies.py index 67f3c4103..a8af05302 100644 --- a/bauh/gems/arch/dependencies.py +++ b/bauh/gems/arch/dependencies.py @@ -7,7 +7,7 @@ from bauh.gems.arch import pacman, message, sorting, confirmation from bauh.gems.arch.aur import AURClient from bauh.gems.arch.exceptions import PackageNotFoundException -from bauh.gems.arch.version import compare_versions +from bauh.gems.arch.version import match_required_version from bauh.view.util.translation import I18n @@ -229,7 +229,7 @@ def _fill_missing_dep(self, dep_name: str, dep_exp: str, aur_index: Iterable[str if len(split_dep) == 3 and split_dep[0] == dep_name: version_provided = split_dep[2] - if compare_versions(version_provided, exp_op, version_required): + if match_required_version(version_provided, exp_op, version_required): matched_providers.add(p) break @@ -275,9 +275,9 @@ def _fill_missing_dep(self, dep_name: str, dep_exp: str, aur_index: Iterable[str split_informed_dep = self.re_dep_operator.split(dep_exp) try: version_required = split_informed_dep[2] - exp_op = split_informed_dep[1] if split_informed_dep[1] != '=' else '==' + exp_op = split_informed_dep[1].strip() - if compare_versions(dep_version, exp_op, version_required): + if match_required_version(dep_version, exp_op, version_required): aur_deps.add(dep_name) missing_deps.add((dep_name, 'aur')) except: @@ -333,9 +333,9 @@ def map_missing_deps(self, pkgs_data: Dict[str, dict], provided_map: Dict[str, S if version_found: version_found = version_found[0].split('=')[1] version_required = dep_split[2] - op = dep_split[1] if dep_split[1] != '=' else '==' + op = dep_split[1].strip() - if not compare_versions(version_found, op, version_required): + if not match_required_version(version_found, op, version_required): self._fill_missing_dep(dep_name=dep_name, dep_exp=dep, aur_index=aur_index, missing_deps=missing_deps, remote_provided_map=remote_provided_map, diff --git a/bauh/gems/arch/mapper.py b/bauh/gems/arch/mapper.py index 30b114250..ce1cd3650 100644 --- a/bauh/gems/arch/mapper.py +++ b/bauh/gems/arch/mapper.py @@ -5,7 +5,7 @@ from bauh.api.abstract.model import PackageStatus from bauh.api.http import HttpClient from bauh.gems.arch.model import ArchPackage -from bauh.gems.arch.version import compare_versions +from bauh.gems.arch.version import normalize_version from bauh.view.util.translation import I18n URL_PKG_DOWNLOAD = 'https://aur.archlinux.org/{}' @@ -61,7 +61,7 @@ def fill_api_data(self, pkg: ArchPackage, api_data: dict, fill_version: bool = T @staticmethod def check_version_update(version: str, latest_version: str) -> bool: if version and latest_version and version != latest_version: - return compare_versions(latest_version, '>', version) + return normalize_version(latest_version) > normalize_version(version) return False diff --git a/bauh/gems/arch/updates.py b/bauh/gems/arch/updates.py index 7a62eafbe..032af4f57 100644 --- a/bauh/gems/arch/updates.py +++ b/bauh/gems/arch/updates.py @@ -12,7 +12,7 @@ from bauh.gems.arch.exceptions import PackageNotFoundException from bauh.gems.arch.model import ArchPackage from bauh.gems.arch.pacman import RE_DEP_OPERATORS -from bauh.gems.arch.version import compare_versions +from bauh.gems.arch.version import match_required_version from bauh.view.util.translation import I18n @@ -725,14 +725,11 @@ def _add_dependency_breakage(self, pkgname: str, pkgdeps: Optional[Set[str]], pr if versions: op = ''.join(RE_DEP_OPERATORS.findall(dep)) - if op == '=': - op = '==' - version_match = False for v in versions: try: - if compare_versions(v, op, dep_split[1]): + if match_required_version(current_version=v, operator=op, required_version=dep_split[1]): version_match = True break except: diff --git a/bauh/gems/arch/version.py b/bauh/gems/arch/version.py index cf4574d42..1f55cc9cc 100644 --- a/bauh/gems/arch/version.py +++ b/bauh/gems/arch/version.py @@ -1,35 +1,51 @@ -from typing import Optional +import re -from packaging.version import parse +from packaging.version import LegacyVersion +RE_VERSION_WITH_RELEASE = re.compile(r'^(.+)-\d+$') +RE_VERSION_WITH_EPOCH = re.compile(r'^\d+:(.+)$') -def normalize_version(version: str) -> Optional[str]: - if version: - final_version = version.strip() - if final_version: - if ':' not in final_version: - final_version = '0:{}'.format(final_version) +def normalize_version(version: str) -> LegacyVersion: + final_version = version.strip() - if '-' not in final_version: - final_version = '{}-1'.format(final_version) + if not RE_VERSION_WITH_EPOCH.match(final_version): + final_version = '0:{}'.format(final_version) - return final_version + if not RE_VERSION_WITH_RELEASE.match(final_version): + final_version = '{}-1'.format(final_version) + return LegacyVersion(final_version) -def compare_versions(version_a: str, operator: str, version_b: str) -> bool: - if operator: - a_obj, b_obj = parse(normalize_version(version_a)), parse(normalize_version(version_b)) - if operator == '>': - return a_obj > b_obj - elif operator == '>=': - return a_obj >= b_obj - elif operator == '<': - return a_obj < b_obj - elif operator == '<=': - return a_obj <= b_obj - elif operator == '==': - return a_obj == b_obj +def match_required_version(current_version: str, operator: str, required_version: str) -> bool: + final_required, final_current = required_version.strip(), current_version.strip() - raise Exception("compare: invalid string operator {}".format(operator)) + required_has_epoch, current_no_epoch = bool(RE_VERSION_WITH_EPOCH.match(final_required)), RE_VERSION_WITH_EPOCH.split(final_current) + current_has_epoch = len(current_no_epoch) > 1 + + if required_has_epoch and not current_has_epoch: + final_current = '0:{}'.format(final_current) + elif current_has_epoch and not required_has_epoch: + final_current = current_no_epoch[1] + + required_has_release, current_no_release = bool(RE_VERSION_WITH_RELEASE.match(final_required)), RE_VERSION_WITH_RELEASE.split(final_current) + current_has_release = len(current_no_release) > 1 + + if required_has_release and not current_has_release: + final_current = '{}-1'.format(final_current) + elif current_has_release and not required_has_release: + final_current = current_no_release[1] + + final_required, final_current = LegacyVersion(final_required), LegacyVersion(final_current) + + if operator == '==' or operator == '=': + return final_current == final_required + elif operator == '>': + return final_current > final_required + elif operator == '>=': + return final_current >= final_required + elif operator == '<': + return final_current < final_required + elif operator == '<=': + return final_current <= final_required diff --git a/tests/gems/arch/test_aur_data_mapper.py b/tests/gems/arch/test_aur_data_mapper.py index 47c01bef2..249461056 100644 --- a/tests/gems/arch/test_aur_data_mapper.py +++ b/tests/gems/arch/test_aur_data_mapper.py @@ -10,7 +10,7 @@ class ArchDataMapperTest(TestCase): @classmethod def setUpClass(cls): - warnings.filterwarnings('ignore') + warnings.filterwarnings('ignore', category=DeprecationWarning) def test_check_version_update(self): self.assertTrue(AURDataMapper.check_version_update('1.0.0-1', '1.0.0-2')) @@ -181,3 +181,17 @@ def test_check_update__pkg_no_last_modified_and_install_date_and_no_last_modifie # in this case, install_date will be considered instead of package's last_modified. # as 'install_date' is higher, only the string versions will be compared self.assertTrue(mapper.check_update(pkg=pkg, last_modified=None)) + + def test_check_version_update__one_version_contain_mixed_letters_and_symbols(self): + self.assertTrue(AURDataMapper.check_version_update('2.2.6', '2.3.3op2')) + self.assertFalse(AURDataMapper.check_version_update('2.3', '2.2.a')) + self.assertTrue(AURDataMapper.check_version_update('2.2.a.123', '2.3')) + + def test_check_update__only_installed_version_with_release_number(self): + self.assertTrue(AURDataMapper.check_version_update('2.2.6-1', '2.3')) + self.assertTrue(AURDataMapper.check_version_update('2.2', '2.2-2')) + self.assertFalse(AURDataMapper.check_version_update('2.2', '2.2-1')) + + def test_check_update__versions_with_epoch(self): + self.assertTrue(AURDataMapper.check_version_update('2.3', '1:2.1')) + self.assertFalse(AURDataMapper.check_version_update('1:1.0', '2.1')) diff --git a/tests/gems/arch/test_version.py b/tests/gems/arch/test_version.py index 435ae3444..3815e80c8 100644 --- a/tests/gems/arch/test_version.py +++ b/tests/gems/arch/test_version.py @@ -4,48 +4,55 @@ from bauh.gems.arch import version -class CompareVersionsTest(TestCase): +class MatchRequiredVersionTest(TestCase): @classmethod def setUpClass(cls): - warnings.filterwarnings('ignore') - - def test_both_versions_only_filled_with_numbers_and_same_number_of_divisions(self): - self.assertFalse(version.compare_versions('1', '>', '2')) - self.assertTrue(version.compare_versions('1', '<', '2')) - self.assertTrue(version.compare_versions('1', '<=', '2')) - self.assertTrue(version.compare_versions('2', '>=', '1')) - self.assertTrue(version.compare_versions('1', '==', '1')) - self.assertFalse(version.compare_versions('1.1', '>', '2.0')) - self.assertTrue(version.compare_versions('1.1', '<', '2.0')) - self.assertTrue(version.compare_versions('1.1', '<=', '2.0')) - self.assertTrue(version.compare_versions('2.1', '>', '2.0')) - self.assertTrue(version.compare_versions('2.1', '>=', '2.0')) - self.assertTrue(version.compare_versions('2.0', '==', '2.0')) - - def test_versions_only_filled_with_numbers_and_different_number_of_divisons(self): - self.assertFalse(version.compare_versions('1.0', '>', '2')) - self.assertTrue(version.compare_versions('1', '<', '2.0')) - self.assertTrue(version.compare_versions('1.1.1', '<=', '2')) - self.assertTrue(version.compare_versions('2', '>=', '1.0')) - self.assertTrue(version.compare_versions('1.0', '==', '1')) - self.assertTrue(version.compare_versions('1.1', '>', '1')) - self.assertFalse(version.compare_versions('1.1', '<', '1')) - - def test_one_version_contain_mixed_letters_and_symbols(self): - self.assertTrue(version.compare_versions('2.3.3op2', '>=', '2.2.6')) - self.assertTrue(version.compare_versions('2.2a', '<', '2.2b')) - self.assertTrue(version.compare_versions('2.2a', '<', '2.3a')) - - def test_versions_with_epochs(self): - self.assertTrue(version.compare_versions('1:1', '==', '1:1.0')) - self.assertTrue(version.compare_versions('1:1', '<', '1:1.1')) - self.assertTrue(version.compare_versions('1:1', '<=', '1:1.1')) - self.assertTrue(version.compare_versions('2:0', '>', '1:1.1')) - self.assertTrue(version.compare_versions('1:0', '>', '2.0-1')) - - def test_versions_with_release_number(self): - self.assertTrue(version.compare_versions('1.0-1', '<', '1.0-2')) - self.assertTrue(version.compare_versions('1.0-2', '>', '1.0-1')) - self.assertTrue(version.compare_versions('1.0-1', '<', '1.0-10')) - self.assertTrue(version.compare_versions('1.0-10', '>', '1.0-1')) + warnings.filterwarnings('ignore', category=DeprecationWarning) + + def test_must_accept_single_or_both_equal_symbols_as_valid(self): + self.assertTrue(version.match_required_version('1', '=', '1')) + self.assertTrue(version.match_required_version('1', '==', '1')) + + def test_must_ignore_release_number_when_required_has_no_defined(self): + self.assertTrue(version.match_required_version('1.3.0-2', '==', '1.3.0')) + self.assertTrue(version.match_required_version('1.3.0-2', '<=', '1.3.0')) + self.assertTrue(version.match_required_version('1.3.0-2', '>=', '1.3.0')) + self.assertFalse(version.match_required_version('1.3.0-2', '<', '1.3.0')) + self.assertFalse(version.match_required_version('1.3.0-2', '>', '1.3.0')) + + def test_must_ignore_epoch_number_when_required_has_no_defined(self): + self.assertTrue(version.match_required_version('1:1.3.0-1', '>', '1.1.0')) + self.assertTrue(version.match_required_version('1:1.3.0-1', '>=', '1.1.0')) + self.assertFalse(version.match_required_version('1:1.3.0-1', '<', '1.1.0')) + self.assertFalse(version.match_required_version('1:1.3.0-1', '<=', '1.1.0')) + self.assertFalse(version.match_required_version('1:1.3.0-1', '==', '1.1.0')) + + def test_must_consider_default_epoch_for_current_version_when_required_has_epoch(self): + self.assertFalse(version.match_required_version('1.1.0', '==', '1:1.1.0')) # 1.1.0 -> 0:1.1.0 + self.assertFalse(version.match_required_version('1.1.0', '>', '1:1.1.0')) # 1.1.0 -> 0:1.1.0 + self.assertFalse(version.match_required_version('1.1.0', '>=', '1:1.1.0')) # 1.1.0 -> 0:1.1.0 + self.assertTrue(version.match_required_version('1.1.0', '<', '1:1.1.0')) # 1.1.0 -> 0:1.1.0 + self.assertTrue(version.match_required_version('1.1.0', '<=', '1:1.1.0')) # 1.1.0 -> 0:1.1.0 + + self.assertTrue(version.match_required_version('1.1.0', '==', '0:1.1.0')) # 1.1.0 -> 0:1.1.0 + + def test_must_match_when_current_version_is_composed_of_alphanumerics_but_required_no(self): + self.assertTrue(version.match_required_version('2.3.3op2', '>', '2.2.6')) + self.assertTrue(version.match_required_version('2.3.3op2', '>=', '2.2.6')) + self.assertFalse(version.match_required_version('2.3.3op2', '==', '2.2.6')) + self.assertFalse(version.match_required_version('2.3.3op2', '<', '2.2.6')) + self.assertFalse(version.match_required_version('2.3.3op2', '<=', '2.2.6')) + + # opposite comparisons + self.assertFalse(version.match_required_version('2.2.6', '>', '2.3.3op2')) + self.assertFalse(version.match_required_version('2.2.6', '>=', '2.3.3op2')) + self.assertFalse(version.match_required_version('2.2.6', '==', '2.3.3op2')) + self.assertTrue(version.match_required_version('2.2.6', '<', '2.3.3op2')) + self.assertTrue(version.match_required_version('2.2.6', '<=', '2.3.3op2')) + + def test_must_match_when_both_versions_are_composed_of_alphanumerics(self): + self.assertTrue(version.match_required_version('2.3.3ab', '==', '2.3.3ab')) + self.assertTrue(version.match_required_version('2.3.3ab', '<', '2.3.3ac')) + self.assertTrue(version.match_required_version('2.3.3ad', '>', '2.3.3ac')) + self.assertTrue(version.match_required_version('2.3.3ad', '<', '2.3.3ad.1')) From 81ad611347918ac15b223f68c656b11fb06480a7 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Fri, 18 Jun 2021 15:24:27 -0300 Subject: [PATCH 07/10] [ui] -> progress bar speed reduced --- CHANGELOG.md | 4 ++++ bauh/view/qt/thread.py | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 38d117724..00a43aa81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Arch - install/upgrade/downgrade: some dependencies not being matched during comparisons between numeric and alphanumeric versions +### UI +- progress bar speed reduced + + ## [0.9.17] 2021-06-16 ### Improvements diff --git a/bauh/view/qt/thread.py b/bauh/view/qt/thread.py index aadb47585..bb41fe847 100644 --- a/bauh/view/qt/thread.py +++ b/bauh/view/qt/thread.py @@ -762,7 +762,7 @@ class AnimateProgress(QThread): def __init__(self): super(AnimateProgress, self).__init__() self.progress_value = 0 - self.increment = 5 + self.increment = 3 self.stop = False self.limit = 100 self.wait_time = 50 @@ -772,7 +772,7 @@ def __init__(self): def _reset(self): self.progress_value = 0 - self.increment = 5 + self.increment = 3 self.stop = False self.limit = 100 self.wait_time = 50 From 39547d499df5ded0440b8e1f735a1311146468d4 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Fri, 18 Jun 2021 15:25:45 -0300 Subject: [PATCH 08/10] [tests] warning filter improved --- tests/gems/arch/test_pacman.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/gems/arch/test_pacman.py b/tests/gems/arch/test_pacman.py index f339313d5..7fd20221c 100644 --- a/tests/gems/arch/test_pacman.py +++ b/tests/gems/arch/test_pacman.py @@ -11,7 +11,7 @@ class PacmanTest(TestCase): @classmethod def setUpClass(cls): - warnings.filterwarnings('ignore') + warnings.filterwarnings('ignore', category=DeprecationWarning) def test_list_ignored_packages(self): ignored = pacman.list_ignored_packages(FILE_DIR + '/resources/pacman_ign_pkgs.conf') From f7bdf4baa4a97ea785914d522b5617f16f52ce3d Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Fri, 18 Jun 2021 16:27:41 -0300 Subject: [PATCH 09/10] Updating CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 00a43aa81..08a6a7055 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). -## [0.9.18] +## [0.9.18] 2021-06-18 ### Fixes - Arch - install/upgrade/downgrade: some dependencies not being matched during comparisons between numeric and alphanumeric versions From a9b36e8bef894335154f02acadde28a1d75979c1 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Fri, 18 Jun 2021 16:36:30 -0300 Subject: [PATCH 10/10] Revert "[ui] -> progress bar speed reduced" This reverts commit 81ad611347918ac15b223f68c656b11fb06480a7. --- CHANGELOG.md | 4 ---- bauh/view/qt/thread.py | 4 ++-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 08a6a7055..014cc8c71 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,10 +9,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Arch - install/upgrade/downgrade: some dependencies not being matched during comparisons between numeric and alphanumeric versions -### UI -- progress bar speed reduced - - ## [0.9.17] 2021-06-16 ### Improvements diff --git a/bauh/view/qt/thread.py b/bauh/view/qt/thread.py index bb41fe847..aadb47585 100644 --- a/bauh/view/qt/thread.py +++ b/bauh/view/qt/thread.py @@ -762,7 +762,7 @@ class AnimateProgress(QThread): def __init__(self): super(AnimateProgress, self).__init__() self.progress_value = 0 - self.increment = 3 + self.increment = 5 self.stop = False self.limit = 100 self.wait_time = 50 @@ -772,7 +772,7 @@ def __init__(self): def _reset(self): self.progress_value = 0 - self.increment = 3 + self.increment = 5 self.stop = False self.limit = 100 self.wait_time = 50