Rename "ldf_cyclic" env option to "lib_dfcyclic"

This commit is contained in:
Ivan Kravets
2015-06-28 19:20:31 +03:00
parent 9c5f9b6e30
commit a928f4aa8f
7 changed files with 24 additions and 22 deletions

View File

@ -64,9 +64,8 @@ Release History
2.0.1 (2015-05-27) 2.0.1 (2015-05-27)
------------------ ------------------
* Handle new environment variables * Handle new environment variable
`PLATFORMIO_BUILD_FLAGS <http://docs.platformio.org/en/latest/envvars.html#platformio-build-flags>`_ `PLATFORMIO_BUILD_FLAGS <http://docs.platformio.org/en/latest/envvars.html#platformio-build-flags>`_
and `PLATFORMIO_LDF_CYCLIC <http://docs.platformio.org/en/latest/envvars.html#platformio-ldf-cyclic>`_
* Pass to API requests information about Continuous Integration system. This * Pass to API requests information about Continuous Integration system. This
information will be used by PlatformIO-API. information will be used by PlatformIO-API.
* Use ``include`` directories from toolchain when initialising project for IDE * Use ``include`` directories from toolchain when initialising project for IDE

View File

@ -84,13 +84,6 @@ PLATFORMIO_SRC_FILTER
Allows to set :ref:`projectconf` option :ref:`projectconf_src_filter`. Allows to set :ref:`projectconf` option :ref:`projectconf_src_filter`.
.. _envvar_PLATFORMIO_LDF_CYCLIC:
PLATFORMIO_LDF_CYCLIC
~~~~~~~~~~~~~~~~~~~~~
Allows to set :ref:`projectconf` option :ref:`projectconf_ldf_cyclic`.
.. _envvar_PLATFORMIO_EXTRA_SCRIPT: .. _envvar_PLATFORMIO_EXTRA_SCRIPT:
PLATFORMIO_EXTRA_SCRIPT PLATFORMIO_EXTRA_SCRIPT

View File

@ -382,13 +382,11 @@ Example:
[env:ignore_some_libs] [env:ignore_some_libs]
ignore_libs = SPI,EngduinoV3_ID123 ignore_libs = SPI,EngduinoV3_ID123
.. _projectconf_ldf_cyclic: ``lib_dfcyclic``
``ldf_cyclic``
^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^
Control cyclic (recursive) behaviour for ``Library Dependency Finder (LDF)``. Control cyclic (recursive) behaviour for ``Library Dependency Finder (LDF)``.
By default, this option is turned OFF (``ldf_cyclic=False``) and means, that By default, this option is turned OFF (``lib_dfcyclic=False``) and means, that
``LDF`` will find only libraries which are included in source files from the ``LDF`` will find only libraries which are included in source files from the
project :ref:`projectconf_pio_src_dir`. project :ref:`projectconf_pio_src_dir`.
@ -396,15 +394,12 @@ If you want to enable cyclic (recursive, nested) search, please set this option
to ``True``. Founded library will be treated like a new source files and to ``True``. Founded library will be treated like a new source files and
``LDF`` will search dependencies for it. ``LDF`` will search dependencies for it.
This option can be set by global environment variable
:ref:`envvar_PLATFORMIO_LDF_CYCLIC`.
Example: Example:
.. code-block:: ini .. code-block:: ini
[env:libs_with_enabled_ldf_cyclic] [env:libs_with_enabled_ldf_cyclic]
ldf_cyclic = True lib_dfcyclic = True
.. _projectconf_extra_script: .. _projectconf_extra_script:

View File

@ -44,7 +44,7 @@ class PlatformioCLI(click.MultiCommand): # pylint: disable=R0904
"Warning! `platformio %s` command is obsoleted and will be " "Warning! `platformio %s` command is obsoleted and will be "
"removed in the next release! Please use " "removed in the next release! Please use "
"`platformio platforms %s` instead." % (name, name), "`platformio platforms %s` instead." % (name, name),
fg="red" fg="yellow"
) )
from platformio.commands import platforms from platformio.commands import platforms
return getattr(platforms, "platforms_" + name) return getattr(platforms, "platforms_" + name)

View File

@ -42,7 +42,7 @@ commonvars.AddVariables(
("SRC_FILTER",), ("SRC_FILTER",),
("IGNORE_LIBS",), ("IGNORE_LIBS",),
("USE_LIBS",), ("USE_LIBS",),
("LDF_CYCLIC",), ("LIB_DFCYCLIC",),
# board options # board options
("BOARD",), ("BOARD",),

View File

@ -300,8 +300,7 @@ def BuildDependentLibraries(env, src_dir): # pylint: disable=R0914
_lib_dir)) _lib_dir))
state['libs'].add(_lib_dir) state['libs'].add(_lib_dir)
if getenv("PLATFORMIO_LDF_CYCLIC", if env.subst("$LIB_DFCYCLIC").lower() == "true":
env.subst("$LDF_CYCLIC")).lower() == "true":
state = _process_src_dir(state, _lib_dir) state = _process_src_dir(state, _lib_dir)
return state return state

View File

@ -73,6 +73,10 @@ def cli(ctx, environment, target, upload_port, # pylint: disable=R0913,R0914
class EnvironmentProcessor(object): class EnvironmentProcessor(object):
RENAMED_OPTIONS = {
"LDF_CYCLIC": "LIB_DFCYCLIC"
}
def __init__(self, cmd_ctx, name, options, # pylint: disable=R0913 def __init__(self, cmd_ctx, name, options, # pylint: disable=R0913
targets, upload_port, verbose): targets, upload_port, verbose):
self.cmd_ctx = cmd_ctx self.cmd_ctx = cmd_ctx
@ -114,9 +118,21 @@ class EnvironmentProcessor(object):
variables.append("UPLOAD_PORT=%s" % self.upload_port) variables.append("UPLOAD_PORT=%s" % self.upload_port)
for k, v in self.options.items(): for k, v in self.options.items():
k = k.upper() k = k.upper()
# process obsolete options
if k in self.RENAMED_OPTIONS:
click.secho(
"Warning! `%s` option is obsoleted and will be "
"removed in the next release! Please use "
"`%s` instead." % (
k.lower(), self.RENAMED_OPTIONS[k].lower()),
fg="yellow"
)
k = self.RENAMED_OPTIONS[k]
if k == "TARGETS" or (k == "UPLOAD_PORT" and self.upload_port): if k == "TARGETS" or (k == "UPLOAD_PORT" and self.upload_port):
continue continue
variables.append("%s=%s" % (k.upper(), v)) variables.append("%s=%s" % (k, v))
return variables return variables
def _get_build_targets(self): def _get_build_targets(self):