diff --git a/HISTORY.rst b/HISTORY.rst index 8eddb985..35418484 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -9,19 +9,16 @@ PlatformIO 3.0 * PIO Home * Integration with `Jenkins CI `_ -* Added `include `__ +* New `include `__ folder for project's header files (`issue #1107 `_) -* Allowed to depend on development platform using VSC URL (Git, Mercurial and Subversion) - in `Project Configuration File "platformio.ini" `__ - Dropped support for ``*_stage`` dev/platforms. Use VCS URL instead. -* New options for `platformio device list `__ - command: - - - ``--serial`` list available serial ports (default) - - ``--logical`` list logical devices - - ``--mdns`` discover multicast DNS services - (`issue #463 `_) +* Depend on development platform using VSC URL (Git, Mercurial and Subversion) instead of a name + in `Project Configuration File "platformio.ini" `__. + Drop support for ``*_stage`` dev/platform names (use VCS URL instead). +* Reinstall/redownload package with a new ``-f, --force`` option for `platformio lib install `__ + and `platformio platform install `__ + commands + (`issue #778 `_) * `Library Dependency Finder (LDF) `__: @@ -35,6 +32,14 @@ PlatformIO 3.0 - Added option to configure library `Compatible Mode `__ using `library.json `__ +* New options for `platformio device list `__ + command: + + - ``--serial`` list available serial ports (default) + - ``--logical`` list logical devices + - ``--mdns`` discover multicast DNS services + (`issue #463 `_) + * Fixed platforms, packages, and libraries updating behind proxy (`issue #1061 `_) * Fixed missing toolchain include paths for project generator diff --git a/docs b/docs index 0c984c49..441416c3 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 0c984c49f2ad98ba37a00c5ab66773df613582ba +Subproject commit 441416c3802d961df6e4083990b2e162a1835acb diff --git a/platformio/commands/lib.py b/platformio/commands/lib.py index e3338816..ddb4c7e7 100644 --- a/platformio/commands/lib.py +++ b/platformio/commands/lib.py @@ -93,11 +93,17 @@ def cli(ctx, **options): "--interactive", is_flag=True, help="Allow to make a choice for all prompts") +@click.option( + "-f", + "--force", + is_flag=True, + help="Reinstall/redownload library if exists") @click.pass_obj -def lib_install(lm, libraries, silent, interactive): +def lib_install(lm, libraries, silent, interactive, force): # @TODO "save" option for library in libraries: - lm.install(library, silent=silent, interactive=interactive) + lm.install( + library, silent=silent, interactive=interactive, force=force) @cli.command("uninstall", short_help="Uninstall libraries") diff --git a/platformio/commands/platform.py b/platformio/commands/platform.py index ff54bc9f..8fcc70b0 100644 --- a/platformio/commands/platform.py +++ b/platformio/commands/platform.py @@ -295,15 +295,21 @@ def platform_show(platform, json_output): # pylint: disable=too-many-branches @click.option("--with-package", multiple=True) @click.option("--without-package", multiple=True) @click.option("--skip-default-package", is_flag=True) +@click.option( + "-f", + "--force", + is_flag=True, + help="Reinstall/redownload dev/platform and its packages if exist") def platform_install(platforms, with_package, without_package, - skip_default_package): + skip_default_package, force): pm = PlatformManager() for platform in platforms: if pm.install( name=platform, with_packages=with_package, without_packages=without_package, - skip_default_package=skip_default_package): + skip_default_package=skip_default_package, + force=force): click.secho( "The platform '%s' has been successfully installed!\n" "The rest of packages will be installed automatically " diff --git a/platformio/managers/lib.py b/platformio/managers/lib.py index 2b20768d..48cba9b5 100644 --- a/platformio/managers/lib.py +++ b/platformio/managers/lib.py @@ -240,7 +240,8 @@ class LibraryManager(BasePkgManager): requirements=None, silent=False, trigger_event=True, - interactive=False): + interactive=False, + force=False): pkg_dir = None try: _name, _requirements, _url = self.parse_pkg_uri(name, requirements) @@ -251,8 +252,13 @@ class LibraryManager(BasePkgManager): silent=silent, interactive=interactive) requirements = _requirements - pkg_dir = BasePkgManager.install(self, name, requirements, silent, - trigger_event) + pkg_dir = BasePkgManager.install( + self, + name, + requirements, + silent=silent, + trigger_event=trigger_event, + force=force) except exception.InternetIsOffline as e: if not silent: click.secho(str(e), fg="yellow") @@ -271,7 +277,12 @@ class LibraryManager(BasePkgManager): for filters in self.normalize_dependencies(manifest['dependencies']): assert "name" in filters if any([s in filters.get("version", "") for s in ("\\", "/")]): - self.install("{name}={version}".format(**filters)) + self.install( + "{name}={version}".format(**filters), + silent=silent, + trigger_event=trigger_event, + interactive=interactive, + force=force) else: try: lib_info = self.search_for_library(filters, silent, @@ -284,14 +295,18 @@ class LibraryManager(BasePkgManager): if filters.get("version"): self.install( lib_info['id'], - requirements=filters.get("version"), + filters.get("version"), silent=silent, - trigger_event=trigger_event) + trigger_event=trigger_event, + interactive=interactive, + force=force) else: self.install( lib_info['id'], silent=silent, - trigger_event=trigger_event) + trigger_event=trigger_event, + interactive=interactive, + force=force) return pkg_dir @staticmethod diff --git a/platformio/managers/package.py b/platformio/managers/package.py index 78be6f99..e8e6dfdd 100644 --- a/platformio/managers/package.py +++ b/platformio/managers/package.py @@ -602,7 +602,8 @@ class BasePkgManager(PkgRepoMixin, PkgInstallerMixin): name, requirements=None, silent=False, - trigger_event=True): + trigger_event=True, + force=False): name, requirements, url = self.parse_pkg_uri(name, requirements) package_dir = self.get_package_dir(name, requirements, url) @@ -614,6 +615,10 @@ class BasePkgManager(PkgRepoMixin, PkgInstallerMixin): return package_dir self.INSTALL_HISTORY.append(history_key) + if package_dir and force: + self.uninstall(package_dir) + package_dir = None + if not package_dir or not silent: msg = "Installing " + click.style(name, fg="cyan") if requirements: diff --git a/platformio/managers/platform.py b/platformio/managers/platform.py index f0baf36d..c97d62c2 100644 --- a/platformio/managers/platform.py +++ b/platformio/managers/platform.py @@ -63,9 +63,10 @@ class PlatformManager(BasePkgManager): skip_default_package=False, trigger_event=True, silent=False, + force=False, **_): # pylint: disable=too-many-arguments, arguments-differ platform_dir = BasePkgManager.install( - self, name, requirements, silent=silent) + self, name, requirements, silent=silent, force=force) p = PlatformFactory.newPlatform(platform_dir) # @Hook: when 'update' operation (trigger_event is False), @@ -76,7 +77,8 @@ class PlatformManager(BasePkgManager): with_packages, without_packages, skip_default_package, - silent=silent) + silent=silent, + force=force) self.cleanup_packages(p.packages.keys()) return True @@ -248,11 +250,13 @@ class PlatformFactory(object): class PlatformPackagesMixin(object): - def install_packages(self, - with_packages=None, - without_packages=None, - skip_default_package=False, - silent=False): + def install_packages( # pylint: disable=too-many-arguments + self, + with_packages=None, + without_packages=None, + skip_default_package=False, + silent=False, + force=False): with_packages = set(self.find_pkg_names(with_packages or [])) without_packages = set(self.find_pkg_names(without_packages or [])) @@ -268,9 +272,10 @@ class PlatformPackagesMixin(object): elif (name in with_packages or not (skip_default_package or opts.get("optional", False))): if ":" in version: - self.pm.install("%s=%s" % (name, version), silent=silent) + self.pm.install( + "%s=%s" % (name, version), silent=silent, force=force) else: - self.pm.install(name, version, silent=silent) + self.pm.install(name, version, silent=silent, force=force) return True