From ebdbf79868cdd7ecdf80f25d0103bb6069584f32 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 28 Jun 2015 19:44:35 +0300 Subject: [PATCH] Rename "use_libs" env option to "lib_use" --- HISTORY.rst | 2 +- docs/projectconf.rst | 14 +++++++------- platformio/builder/main.py | 10 ++++++---- platformio/builder/tools/platformio.py | 4 +--- platformio/commands/run.py | 3 ++- 5 files changed, 17 insertions(+), 16 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 59b240ee..5f4ae07b 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -109,7 +109,7 @@ Release History option in ``platformio.ini`` (`issue #134 `_) * Specify libraries which are compatible with build environment using - `use_libs `_ + `lib_use `_ option in ``platformio.ini`` (`issue #148 `_) * Add more boards to PlatformIO project with diff --git a/docs/projectconf.rst b/docs/projectconf.rst index af298cb1..8364ef2c 100644 --- a/docs/projectconf.rst +++ b/docs/projectconf.rst @@ -352,23 +352,23 @@ You can obtain library IDs using :ref:`cmd_lib_search` command. Example: -.. code-block:: ini +.. code-block:: ini [env:depends_on_some_libs] install_libs = 1,13,19 -``use_libs`` -^^^^^^^^^^^^ +``lib_use`` +^^^^^^^^^^^ Specify libraries which should be used by ``Library Dependency Finder (LDF)`` with the highest priority. Example: -.. code-block:: ini +.. code-block:: ini [env:libs_with_highest_priority] - use_libs = OneWire_ID1 + lib_use = OneWire_ID1,SPI ``lib_ignore`` ^^^^^^^^^^^^^^ @@ -377,7 +377,7 @@ Specify libraries which should be ignored by ``Library Dependency Finder (LDF)`` Example: -.. code-block:: ini +.. code-block:: ini [env:ignore_some_libs] lib_ignore = SPI,EngduinoV3_ID123 @@ -396,7 +396,7 @@ to ``True``. Founded library will be treated like a new source files and Example: -.. code-block:: ini +.. code-block:: ini [env:libs_with_enabled_ldf_cyclic] lib_dfcyclic = True diff --git a/platformio/builder/main.py b/platformio/builder/main.py index 93cc5281..91e9d864 100644 --- a/platformio/builder/main.py +++ b/platformio/builder/main.py @@ -40,9 +40,9 @@ commonvars.AddVariables( ("BUILD_FLAGS",), ("SRCBUILD_FLAGS",), ("SRC_FILTER",), - ("LIB_IGNORE",), - ("USE_LIBS",), ("LIB_DFCYCLIC",), + ("LIB_IGNORE",), + ("LIB_USE",), # board options ("BOARD",), @@ -118,8 +118,10 @@ if "BOARD" in env: env.get("BOARD_OPTIONS", {}).get("platform"))) -if "LIB_IGNORE" in env: - env['LIB_IGNORE'] = [l.strip() for l in env['LIB_IGNORE'].split(",")] +for opt in ("LIB_IGNORE", "LIB_USE"): + if opt not in env: + continue + env[opt] = [l.strip() for l in env[opt].split(",") if l.strip()] env.PrependENVPath( "PATH", diff --git a/platformio/builder/tools/platformio.py b/platformio/builder/tools/platformio.py index e88becb5..6b5f939d 100644 --- a/platformio/builder/tools/platformio.py +++ b/platformio/builder/tools/platformio.py @@ -186,8 +186,6 @@ def BuildDependentLibraries(env, src_dir): # pylint: disable=R0914 INCLUDES_RE = re.compile( r"^\s*#include\s+(\<|\")([^\>\"\']+)(?:\>|\")", re.M) LIBSOURCE_DIRS = [env.subst(d) for d in env.get("LIBSOURCE_DIRS", [])] - USE_LIBS = [l.strip() for l in env.get("USE_LIBS", "").split(",") - if l.strip()] # start internal prototypes @@ -228,7 +226,7 @@ def BuildDependentLibraries(env, src_dir): # pylint: disable=R0914 if not isdir(lsd_dir): continue - for ld in USE_LIBS + sorted(listdir(lsd_dir)): + for ld in env.get("LIB_USE", []) + sorted(listdir(lsd_dir)): if not isdir(join(lsd_dir, ld)): continue diff --git a/platformio/commands/run.py b/platformio/commands/run.py index d9ba2440..b4eee914 100644 --- a/platformio/commands/run.py +++ b/platformio/commands/run.py @@ -75,7 +75,8 @@ class EnvironmentProcessor(object): RENAMED_OPTIONS = { "LDF_CYCLIC": "LIB_DFCYCLIC", - "IGNORE_LIBS": "LIB_IGNORE" + "IGNORE_LIBS": "LIB_IGNORE", + "USE_LIBS": "LIB_USE" } def __init__(self, cmd_ctx, name, options, # pylint: disable=R0913