From d36e39418e95692db127e3c8d20887ae89a52fc4 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 16 Mar 2024 13:45:21 +0200 Subject: [PATCH] Corrected the validation of ``symlink://`` package specifications // Issue #4870 --- HISTORY.rst | 1 + platformio/package/manager/base.py | 21 +++++++++------------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index aac8e1c8..d4ac1284 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -23,6 +23,7 @@ test-driven methodologies, and modern toolchains for unrivaled success. * Introduced the ``--json-output`` option to the `pio test `__ command, enabling users to generate test results in the JSON format * Broadened version support for the ``pyelftools`` dependency, enabling compatibility with lower versions and facilitating integration with a wider range of third-party tools (`issue #4834 `_) * Addressed an issue where passing a relative path (``--project-dir``) to the `pio project init `__ command resulted in an error (`issue #4847 `_) +* Corrected the validation of ``symlink://`` `package specifications `__ , resolving an issue that caused the package manager to repeatedly reinstall dependencies (`pull #4870 `_) * Resolved an issue related to the relative package path in the `pio pkg publish `__ command * Resolved an issue where the |LDF| selected an incorrect library version (`issue #4860 `_) * Resolved an issue with the ``hexlify`` filter in the `device monitor `__ command, ensuring proper representation of characters with Unicode code points higher than 127 (`issue #4732 `_) diff --git a/platformio/package/manager/base.py b/platformio/package/manager/base.py index cfb49ebc..a4ad07ba 100644 --- a/platformio/package/manager/base.py +++ b/platformio/package/manager/base.py @@ -280,18 +280,15 @@ class BasePackageManager( # pylint: disable=too-many-public-methods,too-many-in # external "URL" mismatch if spec.external: - # local folder mismatch - if ( - os.path.abspath(spec.uri) == os.path.abspath(pkg.path) - or ( - spec.uri.startswith("file://") - and os.path.abspath(pkg.path) == os.path.abspath(spec.uri[7:]) - ) - or ( - spec.uri.startswith("symlink://") - and os.path.abspath(pkg.path) == os.path.abspath(spec.uri[10:]) - ) - ): + # local/symlinked folder mismatch + check_conds = [ + os.path.abspath(spec.uri) == os.path.abspath(pkg.path), + spec.uri.startswith("file://") + and os.path.abspath(pkg.path) == os.path.abspath(spec.uri[7:]), + spec.uri.startswith("symlink://") + and os.path.abspath(pkg.path) == os.path.abspath(spec.uri[10:]), + ] + if any(check_conds): return True if spec.uri != pkg.metadata.spec.uri: return False