Skip to content

Commit

Permalink
Follow SemVer complaint version constraints when checking library upd…
Browse files Browse the repository at this point in the history
…ates // Resolve #1281
  • Loading branch information
ivankravets committed Sep 2, 2020
1 parent c8ea64e commit fe4112a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
3 changes: 2 additions & 1 deletion HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ PlatformIO Core 5
* New **Package Management System**

- Integrated PlatformIO Core with the new PlatformIO Registry
- Strict dependency declaration using owner name (resolves name conflicts) (`issue #1824 <https://github.com/platformio/platformio-core/issues/1824>`_)
- Support for owner-based dependency declaration (resolves name conflicts) (`issue #1824 <https://github.com/platformio/platformio-core/issues/1824>`_)
- Automatically save dependencies to `"platformio.ini" <https://docs.platformio.org/page/projectconf.html>`__ when installing using PlatformIO CLI (`issue #2964 <https://github.com/platformio/platformio-core/issues/2964>`_)
- Follow SemVer complaint version constraints when checking library updates `issue #1281 <https://github.com/platformio/platformio-core/issues/1281>`_)
- Dropped support for "packageRepositories" section in "platform.json" manifest (please publish packages directly to the registry)

* **Build System**
Expand Down
13 changes: 9 additions & 4 deletions platformio/commands/lib/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,9 @@ def lib_update( # pylint: disable=too-many-arguments
for storage_dir in storage_dirs:
if not json_output:
print_storage_header(storage_dirs, storage_dir)
lib_deps = ctx.meta.get(CTX_META_STORAGE_LIBDEPS_KEY, {}).get(storage_dir, [])
lm = LibraryPackageManager(storage_dir)
_libraries = libraries or lm.get_installed()
_libraries = libraries or lib_deps or lm.get_installed()

if only_check and json_output:
result = []
Expand Down Expand Up @@ -286,9 +287,13 @@ def lib_update( # pylint: disable=too-many-arguments
to_spec = (
None if isinstance(library, PackageItem) else PackageSpec(library)
)
lm.update(
library, to_spec=to_spec, only_check=only_check, silent=silent
)
try:
lm.update(
library, to_spec=to_spec, only_check=only_check, silent=silent
)
except UnknownPackageError as e:
if library not in lib_deps:
raise e

if json_output:
return click.echo(
Expand Down

0 comments on commit fe4112a

Please sign in to comment.