mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-30 10:07:14 +02:00
Multi-line support for the different options in “platformio.ini” // Resolve #889
This commit is contained in:
@ -4,6 +4,13 @@ Release Notes
|
|||||||
PlatformIO 3.0
|
PlatformIO 3.0
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
|
3.4.0 (2017-??-??)
|
||||||
|
~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
* Multi-line support for the different options in `Project Configuration File "platformio.ini" <http://docs.platformio.org/page/projectconf.html>`__,
|
||||||
|
such as: ``build_flags``, ``build_unflags``, etc.
|
||||||
|
(`issue #889 <https://github.com/platformio/platformio-core/issues/889>`_)
|
||||||
|
|
||||||
3.3.0 (2017-03-27)
|
3.3.0 (2017-03-27)
|
||||||
~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
VERSION = (3, 3, 0)
|
VERSION = (3, 4, "0a1")
|
||||||
__version__ = ".".join([str(s) for s in VERSION])
|
__version__ = ".".join([str(s) for s in VERSION])
|
||||||
|
|
||||||
__title__ = "platformio"
|
__title__ = "platformio"
|
||||||
|
@ -106,6 +106,8 @@ env = DefaultEnvironment(**DEFAULT_ENV_OPTIONS)
|
|||||||
for k in commonvars.keys():
|
for k in commonvars.keys():
|
||||||
if k in env:
|
if k in env:
|
||||||
env[k] = base64.b64decode(env[k])
|
env[k] = base64.b64decode(env[k])
|
||||||
|
if "\n" in env[k]:
|
||||||
|
env[k] = [v.strip() for v in env[k].split("\n") if v.strip()]
|
||||||
|
|
||||||
if env.GetOption('clean'):
|
if env.GetOption('clean'):
|
||||||
env.PioClean(env.subst("$BUILD_DIR"))
|
env.PioClean(env.subst("$BUILD_DIR"))
|
||||||
@ -121,21 +123,23 @@ for var in ("BUILD_FLAGS", "SRC_BUILD_FLAGS", "SRC_FILTER", "EXTRA_SCRIPT",
|
|||||||
continue
|
continue
|
||||||
if var in ("UPLOAD_PORT", "EXTRA_SCRIPT") or not env.get(var):
|
if var in ("UPLOAD_PORT", "EXTRA_SCRIPT") or not env.get(var):
|
||||||
env[var] = environ.get(k)
|
env[var] = environ.get(k)
|
||||||
|
elif isinstance(env[var], list):
|
||||||
|
env.Append(**{var: environ.get(k)})
|
||||||
else:
|
else:
|
||||||
env[var] = "%s%s%s" % (environ.get(k), ", "
|
env[var] = "%s%s%s" % (environ.get(k), ", "
|
||||||
if var == "LIB_EXTRA_DIRS" else " ", env[var])
|
if var == "LIB_EXTRA_DIRS" else " ", env[var])
|
||||||
|
|
||||||
# Parse comma separated items
|
# Parse comma separated items
|
||||||
for opt in ("PIOFRAMEWORK", "LIB_DEPS", "LIB_IGNORE", "LIB_EXTRA_DIRS"):
|
for opt in ("PIOFRAMEWORK", "LIB_DEPS", "LIB_IGNORE", "LIB_EXTRA_DIRS"):
|
||||||
if opt not in env:
|
if opt not in env or isinstance(env[opt], list):
|
||||||
continue
|
continue
|
||||||
env[opt] = [l.strip() for l in env[opt].split(", ") if l.strip()]
|
env[opt] = [l.strip() for l in env[opt].split(", ") if l.strip()]
|
||||||
|
|
||||||
# Configure extra library source directories for LDF
|
# Configure extra library source directories for LDF
|
||||||
if util.get_project_optional_dir("lib_extra_dirs"):
|
if util.get_project_optional_dir("lib_extra_dirs"):
|
||||||
|
items = util.get_project_optional_dir("lib_extra_dirs")
|
||||||
env.Prepend(LIBSOURCE_DIRS=[
|
env.Prepend(LIBSOURCE_DIRS=[
|
||||||
l.strip()
|
l.strip() for l in items.split("\n" if "\n" in items else ", ")
|
||||||
for l in util.get_project_optional_dir("lib_extra_dirs").split(", ")
|
|
||||||
if l.strip()
|
if l.strip()
|
||||||
])
|
])
|
||||||
env.Prepend(LIBSOURCE_DIRS=env.get("LIB_EXTRA_DIRS", []))
|
env.Prepend(LIBSOURCE_DIRS=env.get("LIB_EXTRA_DIRS", []))
|
||||||
|
@ -161,13 +161,15 @@ class EnvironmentProcessor(object):
|
|||||||
# multi-line values to one line
|
# multi-line values to one line
|
||||||
for k, v in self.options.items():
|
for k, v in self.options.items():
|
||||||
if "\n" in v:
|
if "\n" in v:
|
||||||
self.options[k] = self.options[k].strip().replace("\n", ", ")
|
self.options[k] = self.options[k].strip()
|
||||||
|
|
||||||
if not self.silent:
|
if not self.silent:
|
||||||
click.echo("[%s] Processing %s (%s)" % (
|
click.echo("[%s] Processing %s (%s)" %
|
||||||
datetime.now().strftime("%c"), click.style(
|
(datetime.now().strftime("%c"), click.style(
|
||||||
self.name, fg="cyan", bold=True), ", ".join(
|
self.name, fg="cyan", bold=True), ", ".join([
|
||||||
["%s: %s" % (k, v) for k, v in self.options.items()])))
|
"%s: %s" % (k, v.replace("\n", ", "))
|
||||||
|
for k, v in self.options.items()
|
||||||
|
])))
|
||||||
click.secho("-" * terminal_width, bold=True)
|
click.secho("-" * terminal_width, bold=True)
|
||||||
|
|
||||||
self.options = self._validate_options(self.options)
|
self.options = self._validate_options(self.options)
|
||||||
|
Reference in New Issue
Block a user