From 465c90a7b6361e1cbe223f8567c7c147e29f3edc Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Fri, 15 Jan 2021 17:56:02 -0300 Subject: [PATCH] [arch] fix -> 'rebuild-detector' integration not working when launched from KDE menu or PyCharm --- CHANGELOG.md | 4 +--- README.md | 2 +- bauh/commons/system.py | 5 ++++- bauh/gems/arch/config.py | 2 +- bauh/gems/arch/controller.py | 4 ---- bauh/gems/arch/rebuild_detector.py | 2 +- 6 files changed, 8 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eea380b4..6eb1fd66 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - [rebuild-detector](https://github.com/maximbaz/rebuild-detector) integration - if a package needs to be rebuilt, it will be marked for update (rebuild-detector must be installed on your system, but it is not a hard requirement). - if you hold the mouse over the package 'version' the message "The package needs to be reinstalled" will be displayed. - - this integration is still in testing and can be controlled though the new settings property **aur_rebuild_detector** (default: false). + - this integration can be controlled though the new settings property **aur_rebuild_detector** (default: true).

@@ -25,8 +25,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

- - form some reason **rebuild-detector** hangs when executed within PyCharm (this integration is disabled regarding this particular scenario for now) - - new custom action to quickly reinstall a package

diff --git a/README.md b/README.md index 96cb8c5c..77a37e08 100644 --- a/README.md +++ b/README.md @@ -214,7 +214,7 @@ check_dependency_breakage: true # if, during the verification of the update requ suggest_unneeded_uninstall: false # if the dependencies apparently no longer necessary associated with the uninstalled packages should be suggested for uninstallation. When this property is enabled it automatically disables the property 'suggest_optdep_uninstall'. Default: false (to prevent new users from making mistakes) suggest_optdep_uninstall: false # if the optional dependencies associated with uninstalled packages should be suggested for uninstallation. Only the optional dependencies that are not dependencies of other packages will be suggested. Default: false (to prevent new users from making mistakes) categories_exp: 24 # It defines the expiration time (in HOURS) of the packages categories mapping file stored in disc. Use 0 so that it is always updated during initialization. -aur_rebuild_detector: false # it checks if packages built with old library versions require to be rebuilt. If a package needs to be rebuilt, it will be marked for update ({} must be installed). Default: false. +aur_rebuild_detector: true # it checks if packages built with old library versions require to be rebuilt. If a package needs to be rebuilt, it will be marked for update ('rebuild-detector' must be installed). Default: true. ``` - Required dependencies: - **pacman** diff --git a/bauh/commons/system.py b/bauh/commons/system.py index cc923877..77735ed0 100644 --- a/bauh/commons/system.py +++ b/bauh/commons/system.py @@ -323,7 +323,7 @@ def check_enabled_services(*names: str) -> Dict[str, bool]: return {s: status[i].strip().lower() == 'enabled' for i, s in enumerate(names) if s} -def execute(cmd: str, shell: bool = False, cwd: Optional[str] = None, output: bool = True, custom_env: Optional[dict] = None) -> Tuple[int, Optional[str]]: +def execute(cmd: str, shell: bool = False, cwd: Optional[str] = None, output: bool = True, custom_env: Optional[dict] = None, stdin: bool = True) -> Tuple[int, Optional[str]]: params = { 'args': cmd.split(' ') if not shell else [cmd], 'stdout': subprocess.PIPE if output else subprocess.DEVNULL, @@ -331,6 +331,9 @@ def execute(cmd: str, shell: bool = False, cwd: Optional[str] = None, output: bo 'shell': shell } + if not stdin: + params['stdin'] = subprocess.DEVNULL + if cwd is not None: params['cwd'] = cwd diff --git a/bauh/gems/arch/config.py b/bauh/gems/arch/config.py index 2ee4e198..29b6340d 100644 --- a/bauh/gems/arch/config.py +++ b/bauh/gems/arch/config.py @@ -39,4 +39,4 @@ class ArchConfigManager(YAMLConfigManager): 'suggest_optdep_uninstall': False, 'aur_idx_exp': 1, 'categories_exp': 24, - 'aur_rebuild_detector': False} + 'aur_rebuild_detector': True} diff --git a/bauh/gems/arch/controller.py b/bauh/gems/arch/controller.py index e96b9c65..8209a33a 100644 --- a/bauh/gems/arch/controller.py +++ b/bauh/gems/arch/controller.py @@ -583,10 +583,6 @@ class ArchManager(SoftwareManager): def __fill_packages_to_rebuild(self, output: Dict[str, Set[str]]): if rebuild_detector.is_installed(): - if 'PYCHARM_CLASSPATH' in os.environ: - self.logger.warning("'rebuild-detector' is currently not working within PyCharm. Aborting...") - return - self.logger.info("rebuild-detector: checking") to_rebuild = rebuild_detector.list_required_rebuild() output['to_rebuild'].update(to_rebuild) diff --git a/bauh/gems/arch/rebuild_detector.py b/bauh/gems/arch/rebuild_detector.py index 5c8c59f3..96d2cce8 100644 --- a/bauh/gems/arch/rebuild_detector.py +++ b/bauh/gems/arch/rebuild_detector.py @@ -11,7 +11,7 @@ def is_installed() -> bool: def list_required_rebuild() -> Set[str]: - code, output = system.execute(cmd='checkrebuild') + code, output = system.execute(cmd='checkrebuild', shell=True, stdin=False) required = set() if code == 0 and output: