From 643f2900572a83d68ac8ce2bb695aeee999cbd4f Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 29 Dec 2019 17:43:50 +0200 Subject: [PATCH] Fix issue with library.properties manifest parser when author email is not specified --- platformio/package/manifest/parser.py | 2 +- tests/test_pkgmanifest.py | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/platformio/package/manifest/parser.py b/platformio/package/manifest/parser.py index 3e2ff5ac..8abed35b 100644 --- a/platformio/package/manifest/parser.py +++ b/platformio/package/manifest/parser.py @@ -480,7 +480,7 @@ class LibraryPropertiesManifestParser(BaseManifestParser): continue found = True item["maintainer"] = True - if not item.get("email"): + if not item.get("email") and email: item["email"] = email if not found: authors.append( diff --git a/tests/test_pkgmanifest.py b/tests/test_pkgmanifest.py index 978ba1b4..de59e0db 100644 --- a/tests/test_pkgmanifest.py +++ b/tests/test_pkgmanifest.py @@ -161,6 +161,7 @@ customField=Custom Value "architectures=*\n" + contents ).as_dict() assert data["platforms"] == ["*"] + # Platforms specific data = parser.LibraryPropertiesManifestParser( "architectures=avr, esp32\n" + contents @@ -184,7 +185,7 @@ customField=Custom Value "type": "git", } - # Hope page + # Home page data = parser.LibraryPropertiesManifestParser( "url=https://github.com/username/reponame.git\n" + contents ).as_dict() @@ -193,6 +194,17 @@ customField=Custom Value "url": "https://github.com/username/reponame.git", } + # Author + Maintainer + data = parser.LibraryPropertiesManifestParser( + """ +author=Rocket Scream Electronics +maintainer=Rocket Scream Electronics +""" + ).as_dict() + assert data["authors"] == [ + {"name": "Rocket Scream Electronics", "maintainer": True} + ] + def test_library_json_schema(): contents = """