forked from platformio/platformio-core
Pre/Post extra scripting for advanced control of PIO Build System // Resolve #891
This commit is contained in:
@@ -77,10 +77,8 @@ def cli(ctx, environment, target, upload_port, project_dir, silent, verbose,
|
||||
|
||||
env_default = None
|
||||
if config.has_option("platformio", "env_default"):
|
||||
env_default = [
|
||||
e.strip()
|
||||
for e in config.get("platformio", "env_default").split(", ")
|
||||
]
|
||||
env_default = util.parse_conf_multi_values(
|
||||
config.get("platformio", "env_default"))
|
||||
|
||||
results = []
|
||||
start_time = time()
|
||||
@@ -130,7 +128,7 @@ class EnvironmentProcessor(object):
|
||||
KNOWN_OPTIONS = ("platform", "framework", "board", "board_mcu",
|
||||
"board_f_cpu", "board_f_flash", "board_flash_mode",
|
||||
"build_flags", "src_build_flags", "build_unflags",
|
||||
"src_filter", "extra_script", "targets", "upload_port",
|
||||
"src_filter", "extra_scripts", "targets", "upload_port",
|
||||
"upload_protocol", "upload_speed", "upload_flags",
|
||||
"upload_resetmethod", "lib_deps", "lib_ignore",
|
||||
"lib_extra_dirs", "lib_ldf_mode", "lib_compat_mode",
|
||||
@@ -149,7 +147,11 @@ class EnvironmentProcessor(object):
|
||||
|
||||
REMAPED_OPTIONS = {"framework": "pioframework", "platform": "pioplatform"}
|
||||
|
||||
RENAMED_OPTIONS = {"lib_use": "lib_deps", "lib_force": "lib_deps"}
|
||||
RENAMED_OPTIONS = {
|
||||
"lib_use": "lib_deps",
|
||||
"lib_force": "lib_deps",
|
||||
"extra_script": "extra_scripts"
|
||||
}
|
||||
|
||||
RENAMED_PLATFORMS = {"espressif": "espressif8266"}
|
||||
|
||||
@@ -178,13 +180,13 @@ class EnvironmentProcessor(object):
|
||||
self.options[k] = self.options[k].strip()
|
||||
|
||||
if not self.silent:
|
||||
click.echo("[%s] Processing %s (%s)" %
|
||||
(datetime.now().strftime("%c"),
|
||||
click.style(self.name, fg="cyan", bold=True),
|
||||
"; ".join([
|
||||
"%s: %s" % (k, v.replace("\n", ", "))
|
||||
for k, v in self.options.items()
|
||||
])))
|
||||
click.echo(
|
||||
"[%s] Processing %s (%s)" %
|
||||
(datetime.now().strftime("%c"),
|
||||
click.style(self.name, fg="cyan", bold=True), "; ".join([
|
||||
"%s: %s" % (k, ", ".join(util.parse_conf_multi_values(v)))
|
||||
for k, v in self.options.items()
|
||||
])))
|
||||
click.secho("-" * terminal_width, bold=True)
|
||||
|
||||
self.options = self._validate_options(self.options)
|
||||
@@ -276,12 +278,10 @@ class EnvironmentProcessor(object):
|
||||
if d.strip()
|
||||
], self.verbose)
|
||||
if "lib_deps" in self.options:
|
||||
_autoinstall_libdeps(self.cmd_ctx, [
|
||||
d.strip()
|
||||
for d in self.options['lib_deps'].split(
|
||||
"\n" if "\n" in self.options['lib_deps'] else ", ")
|
||||
if d.strip()
|
||||
], self.verbose)
|
||||
_autoinstall_libdeps(
|
||||
self.cmd_ctx,
|
||||
util.parse_conf_multi_values(self.options['lib_deps']),
|
||||
self.verbose)
|
||||
|
||||
try:
|
||||
p = PlatformFactory.newPlatform(self.options['platform'])
|
||||
@@ -296,6 +296,8 @@ class EnvironmentProcessor(object):
|
||||
|
||||
|
||||
def _autoinstall_libdeps(ctx, libraries, verbose=False):
|
||||
if not libraries:
|
||||
return
|
||||
storage_dir = util.get_projectlibdeps_dir()
|
||||
ctx.obj = LibraryManager(storage_dir)
|
||||
if verbose:
|
||||
|
Reference in New Issue
Block a user