Fix multi line items for lib_deps // Resolve #931

This commit is contained in:
Ivan Kravets
2017-04-02 21:58:38 +03:00
parent a60792d20e
commit b5217682fd
4 changed files with 13 additions and 10 deletions

View File

@ -14,7 +14,7 @@
import sys
VERSION = (3, 4, "0a3")
VERSION = (3, 4, "0a4")
__version__ = ".".join([str(s) for s in VERSION])
__title__ = "platformio"

View File

@ -78,7 +78,7 @@ def cli(ctx, environment, target, upload_port, project_dir, silent, verbose,
if config.has_option("platformio", "env_default"):
env_default = [
e.strip()
for e in config.get("platformio", "env_default").split(",")
for e in config.get("platformio", "env_default").split(", ")
]
results = []
@ -159,15 +159,13 @@ class EnvironmentProcessor(object):
terminal_width, _ = click.get_terminal_size()
start_time = time()
# multi-line values to one line
for k, v in self.options.items():
if "\n" in v:
self.options[k] = self.options[k].strip()
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([
self.name, fg="cyan", bold=True), "; ".join([
"%s: %s" % (k, v.replace("\n", ", "))
for k, v in self.options.items()
])))
@ -236,7 +234,7 @@ class EnvironmentProcessor(object):
if self.targets:
targets = [t for t in self.targets]
elif "targets" in self.options:
targets = self.options['targets'].split()
targets = self.options['targets'].split(", ")
return targets
def _run(self):
@ -258,7 +256,9 @@ class EnvironmentProcessor(object):
], self.verbose)
if "lib_deps" in self.options:
_autoinstall_libdeps(self.cmd_ctx, [
d.strip() for d in self.options['lib_deps'].split(", ")
d.strip()
for d in self.options['lib_deps'].split(
"\n" if "\n" in self.options['lib_deps'] else ", ")
if d.strip()
], self.verbose)

View File

@ -607,7 +607,7 @@ class BasePkgManager(PkgRepoMixin, PkgInstallerMixin):
name, requirements, url = self.parse_pkg_input(name, requirements)
package_dir = self.get_package_dir(name, requirements, url)
if not package_dir and not silent:
if not package_dir or not silent:
msg = "Installing " + click.style(name, fg="cyan")
if requirements:
msg += " @ " + requirements

View File

@ -278,7 +278,10 @@ def measure_ci():
def on_run_environment(options, targets):
opts = ["%s=%s" % (opt, value) for opt, value in sorted(options.items())]
opts = [
"%s=%s" % (opt, value.replace("\n", ", ") if "\n" in value else value)
for opt, value in sorted(options.items())
]
targets = [t.title() for t in targets or ["run"]]
on_event("Env", " ".join(targets), "&".join(opts))