From 92655c30c18fdf75acc28650ad9d14c80c87e778 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 23 Jan 2021 22:34:48 +0200 Subject: [PATCH] Disabled automatic removal of unnecessary development platform packages // Resolve #3708 , Resolve #/3770 --- HISTORY.rst | 1 + platformio/package/manager/platform.py | 32 -------------------------- 2 files changed, 1 insertion(+), 32 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 826419bd..b60d4a2e 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -15,6 +15,7 @@ PlatformIO Core 5 * Improved listing of `multicast DNS services `_ * Check for debugging server's "ready_pattern" in "stderr" * Upgraded build engine to the SCons 4.1 (`release notes `_) +* Disabled automatic removal of unnecessary development platform packages (`issue #3708 `_, `issue #3770 `_) * Fixed a "UnicodeDecodeError: 'utf-8' codec can't decode byte" when using J-Link for firmware uploading on Linux (`issue #3804 `_) * Fixed an issue with Python 3.8+ on Windows when a network drive is used (`issue #3417 `_) * Fixed an issue when "strict" compatibility mode was not used for a library with custom "platforms" field in `library.json `__ manifest (`issue #3806 `_) diff --git a/platformio/package/manager/platform.py b/platformio/package/manager/platform.py index 7626d4d9..5c52630d 100644 --- a/platformio/package/manager/platform.py +++ b/platformio/package/manager/platform.py @@ -69,7 +69,6 @@ class PlatformPackageManager(BasePackageManager): # pylint: disable=too-many-an ) p.install_python_packages() p.on_installed() - self.autoremove_packages(list(p.packages)) return pkg def uninstall(self, spec, silent=False, skip_dependencies=False): @@ -83,7 +82,6 @@ class PlatformPackageManager(BasePackageManager): # pylint: disable=too-many-an if not skip_dependencies: p.uninstall_python_packages() p.on_uninstalled() - self.autoremove_packages(list(p.packages)) return pkg def update( # pylint: disable=arguments-differ, too-many-arguments @@ -118,8 +116,6 @@ class PlatformPackageManager(BasePackageManager): # pylint: disable=too-many-an ) p.update_packages(only_check) - if not only_check: - self.autoremove_packages(list(p.packages)) if missed_pkgs: p.install_packages( @@ -128,34 +124,6 @@ class PlatformPackageManager(BasePackageManager): # pylint: disable=too-many-an return new_pkg or pkg - def autoremove_packages(self, names): - self.memcache_reset() - required = {} - for platform in PlatformPackageManager().get_installed(): - p = PlatformFactory.new(platform) - for pkg in p.get_installed_packages(): - if pkg.metadata.name not in required: - required[pkg.metadata.name] = set() - required[pkg.metadata.name].add(pkg.metadata.version) - - pm = ToolPackageManager() - for pkg in pm.get_installed(): - skip_conds = [ - pkg.metadata.name not in names, - pkg.metadata.spec.url, - pkg.metadata.name in required - and pkg.metadata.version in required[pkg.metadata.name], - ] - if any(skip_conds): - continue - try: - pm.uninstall(pkg.metadata.spec) - except UnknownPackageError: - pass - - self.memcache_reset() - return True - @util.memoized(expire="5s") def get_installed_boards(self): boards = []