diff --git a/HISTORY.rst b/HISTORY.rst index ea04061a..1c444e3c 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -12,7 +12,8 @@ PlatformIO Core 4 * Added support for Arm Mbed "module.json" ``dependencies`` field (`issue #3400 `_) * Fixed an issue when quitting from PlatformIO IDE does not shutdown PIO Home server * Fixed an issue "the JSON object must be str, not 'bytes'" when PIO Home is used with Python 3.5 (`issue #3396 `_) -* Fixed an issue when Python 2 does not keep encoding when converting .INO file (`issue #3393 `_) +* Fixed an issue when Python 2 does not keep encoding when converting ".ino" (`issue #3393 `_) +* Fixed an issue when ``"libArchive": false`` in "library.json" does not work (`issue #3403 `_) 4.2.1 (2020-02-17) ~~~~~~~~~~~~~~~~~~ diff --git a/platformio/builder/tools/piolib.py b/platformio/builder/tools/piolib.py index 1a659c6a..5cb50492 100644 --- a/platformio/builder/tools/piolib.py +++ b/platformio/builder/tools/piolib.py @@ -717,9 +717,11 @@ class PlatformIOLibBuilder(LibBuilderBase): @property def lib_archive(self): - unique_value = "_not_declared_%s" % id(self) - global_value = self.env.GetProjectOption("lib_archive", unique_value) - if global_value != unique_value: + missing = object() + global_value = self.env.GetProjectConfig().getraw( + "env:" + self.env["PIOENV"], "lib_archive", missing + ) + if global_value != missing: return global_value return self._manifest.get("build", {}).get( "libArchive", LibBuilderBase.lib_archive.fget(self) diff --git a/platformio/builder/tools/pioproject.py b/platformio/builder/tools/pioproject.py index 4a42b3d8..4bf848d9 100644 --- a/platformio/builder/tools/pioproject.py +++ b/platformio/builder/tools/pioproject.py @@ -14,7 +14,7 @@ from __future__ import absolute_import -from platformio.project.config import ProjectConfig, ProjectOptions +from platformio.project.config import MISSING, ProjectConfig, ProjectOptions def GetProjectConfig(env): @@ -25,7 +25,7 @@ def GetProjectOptions(env, as_dict=False): return env.GetProjectConfig().items(env=env["PIOENV"], as_dict=as_dict) -def GetProjectOption(env, option, default=None): +def GetProjectOption(env, option, default=MISSING): return env.GetProjectConfig().get("env:" + env["PIOENV"], option, default) diff --git a/platformio/project/config.py b/platformio/project/config.py index 4dc3c38c..23d089bf 100644 --- a/platformio/project/config.py +++ b/platformio/project/config.py @@ -280,7 +280,7 @@ class ProjectConfigBase(object): value = envvar_value if value == MISSING: - value = option_meta.default or default + value = default if default != MISSING else option_meta.default if value == MISSING: return None diff --git a/tests/test_projectconf.py b/tests/test_projectconf.py index 8172e692..0e68f2d3 100644 --- a/tests/test_projectconf.py +++ b/tests/test_projectconf.py @@ -123,6 +123,8 @@ def test_defaults(config): ) assert config.get("env:extra_2", "lib_compat_mode") == "soft" assert config.get("env:extra_2", "build_type") == "release" + assert config.get("env:extra_2", "build_type", None) is None + assert config.get("env:extra_2", "lib_archive", "no") is False def test_sections(config):