forked from platformio/platformio-core
Merge branch 'hotfix/v3.5.4' into develop
* hotfix/v3.5.4: Fix issue when "platformio lib uninstall" removes initial source code // Resolve #1023
This commit is contained in:
@ -27,6 +27,10 @@ PlatformIO 3.0
|
||||
* Fixed issue with invalid LD script if path contains space
|
||||
* Fixed preprocessor for Arduino sketch when function returns certain type
|
||||
(`issue #1683 <https://github.com/platformio/platformio-core/issues/1683>`_)
|
||||
* Fixed issue when `
|
||||
platformio lib uninstall <http://docs.platformio.org/page/userguide/lib/cmd_uninstall.html>`__
|
||||
removes initial source code
|
||||
(`issue #1023 <https://github.com/platformio/platformio-core/issues/1023>`_)
|
||||
|
||||
3.5.3 (2018-06-01)
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
@ -18,7 +18,7 @@ import json
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
from os.path import basename, getsize, isdir, isfile, islink, join
|
||||
from os.path import abspath, basename, getsize, isdir, isfile, islink, join
|
||||
from tempfile import mkdtemp
|
||||
|
||||
import click
|
||||
@ -367,6 +367,12 @@ class PkgInstallerMixin(object):
|
||||
return manifest.get("__pkg_dir") if manifest and isdir(
|
||||
manifest.get("__pkg_dir")) else None
|
||||
|
||||
def get_package_by_dir(self, pkg_dir):
|
||||
for manifest in self.get_installed():
|
||||
if manifest['__pkg_dir'] == util.path_to_unicode(abspath(pkg_dir)):
|
||||
return manifest
|
||||
return None
|
||||
|
||||
def find_pkg_root(self, src_dir):
|
||||
if self.manifest_exists(src_dir):
|
||||
return src_dir
|
||||
@ -715,7 +721,7 @@ class BasePkgManager(PkgRepoMixin, PkgInstallerMixin):
|
||||
return pkg_dir
|
||||
|
||||
def uninstall(self, package, requirements=None, after_update=False):
|
||||
if isdir(package):
|
||||
if isdir(package) and self.get_package_by_dir(package):
|
||||
pkg_dir = package
|
||||
else:
|
||||
name, requirements, url = self.parse_pkg_uri(package, requirements)
|
||||
@ -755,7 +761,7 @@ class BasePkgManager(PkgRepoMixin, PkgInstallerMixin):
|
||||
return True
|
||||
|
||||
def update(self, package, requirements=None, only_check=False):
|
||||
if isdir(package):
|
||||
if isdir(package) and self.get_package_by_dir(package):
|
||||
pkg_dir = package
|
||||
else:
|
||||
pkg_dir = self.get_package_dir(*self.parse_pkg_uri(package))
|
||||
|
Reference in New Issue
Block a user