mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-31 02:27:13 +02:00
Improve platform auto-installing (especially for @SmartAthill)
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
# Copyright (C) Ivan Kravets <me@ikravets.com>
|
# Copyright (C) Ivan Kravets <me@ikravets.com>
|
||||||
# See LICENSE for details.
|
# See LICENSE for details.
|
||||||
|
|
||||||
VERSION = (2, 2, "1a0")
|
VERSION = (2, 2, "1a1")
|
||||||
__version__ = ".".join([str(s) for s in VERSION])
|
__version__ = ".".join([str(s) for s in VERSION])
|
||||||
|
|
||||||
__title__ = "platformio"
|
__title__ = "platformio"
|
||||||
|
@ -163,7 +163,7 @@ class EnvironmentProcessor(object):
|
|||||||
telemetry.on_run_environment(self.options, build_targets)
|
telemetry.on_run_environment(self.options, build_targets)
|
||||||
|
|
||||||
# install platform and libs dependencies
|
# install platform and libs dependencies
|
||||||
_autoinstall_platform(self.cmd_ctx, platform)
|
_autoinstall_platform(self.cmd_ctx, platform, build_targets)
|
||||||
if "lib_install" in self.options:
|
if "lib_install" in self.options:
|
||||||
_autoinstall_libs(self.cmd_ctx, self.options['lib_install'])
|
_autoinstall_libs(self.cmd_ctx, self.options['lib_install'])
|
||||||
|
|
||||||
@ -171,14 +171,34 @@ class EnvironmentProcessor(object):
|
|||||||
return p.run(build_vars, build_targets, self.verbose_level)
|
return p.run(build_vars, build_targets, self.verbose_level)
|
||||||
|
|
||||||
|
|
||||||
def _autoinstall_platform(ctx, platform):
|
def _autoinstall_platform(ctx, platform, targets):
|
||||||
installed_platforms = PlatformFactory.get_platforms(
|
installed_platforms = PlatformFactory.get_platforms(
|
||||||
installed=True).keys()
|
installed=True).keys()
|
||||||
if (platform not in installed_platforms and (
|
cmd_options = {}
|
||||||
not app.get_setting("enable_prompts") or
|
p = PlatformFactory.newPlatform(platform)
|
||||||
|
|
||||||
|
if "uploadlazy" in targets:
|
||||||
|
upload_tools = p.pkg_aliases_to_names(["uploader"])
|
||||||
|
|
||||||
|
# platform without uploaders
|
||||||
|
if not upload_tools and platform in installed_platforms:
|
||||||
|
return
|
||||||
|
# uploaders are already installed
|
||||||
|
if set(upload_tools) <= set(p.get_installed_packages()):
|
||||||
|
return
|
||||||
|
|
||||||
|
cmd_options['skip_default_package'] = True
|
||||||
|
if upload_tools:
|
||||||
|
cmd_options['with_package'] = ["uploader"]
|
||||||
|
|
||||||
|
elif (set(p.pkg_aliases_to_names(["toolchain"])) <=
|
||||||
|
set(p.get_installed_packages())):
|
||||||
|
return
|
||||||
|
|
||||||
|
if (not app.get_setting("enable_prompts") or
|
||||||
click.confirm("The platform '%s' has not been installed yet. "
|
click.confirm("The platform '%s' has not been installed yet. "
|
||||||
"Would you like to install it now?" % platform))):
|
"Would you like to install it now?" % platform)):
|
||||||
ctx.invoke(cmd_platforms_install, platforms=[platform])
|
ctx.invoke(cmd_platforms_install, platforms=[platform], **cmd_options)
|
||||||
|
|
||||||
|
|
||||||
def _autoinstall_libs(ctx, libids_list):
|
def _autoinstall_libs(ctx, libids_list):
|
||||||
|
Reference in New Issue
Block a user