Skip to content

Commit

Permalink
Fixed an issue when saving libraries in new project results in error …
Browse files Browse the repository at this point in the history
…"No option 'lib_deps' in section" // Resolve #3442
  • Loading branch information
ivankravets committed Mar 27, 2020
1 parent 1b0810e commit e92b498
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ PlatformIO Core 4
~~~~~~~~~~~~~~~~~~

* Fixed UnicodeDecodeError on Windows when network drive (NAS) is used (`issue #3417 <https://github.com/platformio/platformio-core/issues/3417>`_)
* Fixed an issue when saving libraries in new project results in error "No option 'lib_deps' in section" (`issue #3442 <https://github.com/platformio/platformio-core/issues/3442>`_)

4.3.1 (2020-03-20)
~~~~~~~~~~~~~~~~~~
Expand Down
6 changes: 5 additions & 1 deletion platformio/commands/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
from platformio.package.manifest.schema import ManifestSchema
from platformio.proc import is_ci
from platformio.project.config import ProjectConfig
from platformio.project.exception import InvalidProjectConfError
from platformio.project.helpers import get_project_dir, is_platformio_project

try:
Expand Down Expand Up @@ -180,7 +181,10 @@ def lib_install( # pylint: disable=too-many-arguments
if project_environments and env not in project_environments:
continue
config.expand_interpolations = False
lib_deps = config.get("env:" + env, "lib_deps", [])
try:
lib_deps = config.get("env:" + env, "lib_deps")
except InvalidProjectConfError:
lib_deps = []
for library in libraries:
if library in lib_deps:
continue
Expand Down
8 changes: 8 additions & 0 deletions tests/test_projectconf.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,19 @@ def test_defaults(config):
assert config.get_optional_dir("core") == os.path.join(
os.path.expanduser("~"), ".platformio"
)
assert config.get("strict_ldf", "lib_deps", ["Empty"]) == ["Empty"]
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

config.expand_interpolations = False
with pytest.raises(
InvalidProjectConfError, match="No option 'lib_deps' in section: 'strict_ldf'"
):
assert config.get("strict_ldf", "lib_deps", ["Empty"]) == ["Empty"]
config.expand_interpolations = True


def test_sections(config):
with pytest.raises(ConfigParser.NoSectionError):
Expand Down

0 comments on commit e92b498

Please sign in to comment.