Skip to content

Commit

Permalink
Fixed an issue when "libArchive": false in "library.json" does no…
Browse files Browse the repository at this point in the history
…t work // Resolve #3403
  • Loading branch information
ivankravets committed Mar 5, 2020
1 parent 3a27fbc commit 59e1c88
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
3 changes: 2 additions & 1 deletion HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ PlatformIO Core 4
* Added support for Arm Mbed "module.json" ``dependencies`` field (`issue #3400 <https://github.com/platformio/platformio-core/issues/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 <https://github.com/platformio/platformio-core/issues/3396>`_)
* Fixed an issue when Python 2 does not keep encoding when converting .INO file (`issue #3393 <https://github.com/platformio/platformio-core/issues/3393>`_)
* Fixed an issue when Python 2 does not keep encoding when converting ".ino" (`issue #3393 <https://github.com/platformio/platformio-core/issues/3393>`_)
* Fixed an issue when ``"libArchive": false`` in "library.json" does not work (`issue #3403 <https://github.com/platformio/platformio-core/issues/3403>`_)

4.2.1 (2020-02-17)
~~~~~~~~~~~~~~~~~~
Expand Down
8 changes: 5 additions & 3 deletions platformio/builder/tools/piolib.py
Original file line number Diff line number Diff line change
Expand Up @@ -717,9 +717,11 @@ def extra_script(self):

@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)
Expand Down
4 changes: 2 additions & 2 deletions platformio/builder/tools/pioproject.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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)


Expand Down
2 changes: 1 addition & 1 deletion platformio/project/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def getraw( # pylint: disable=too-many-branches
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

Expand Down
2 changes: 2 additions & 0 deletions tests/test_projectconf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 59e1c88

Please sign in to comment.