Fix issue with library.properties manifest parser when author email is not specified

This commit is contained in:
Ivan Kravets
2019-12-29 17:43:50 +02:00
parent ea0b462d0b
commit 643f290057
2 changed files with 14 additions and 2 deletions

View File

@ -480,7 +480,7 @@ class LibraryPropertiesManifestParser(BaseManifestParser):
continue continue
found = True found = True
item["maintainer"] = True item["maintainer"] = True
if not item.get("email"): if not item.get("email") and email:
item["email"] = email item["email"] = email
if not found: if not found:
authors.append( authors.append(

View File

@ -161,6 +161,7 @@ customField=Custom Value
"architectures=*\n" + contents "architectures=*\n" + contents
).as_dict() ).as_dict()
assert data["platforms"] == ["*"] assert data["platforms"] == ["*"]
# Platforms specific # Platforms specific
data = parser.LibraryPropertiesManifestParser( data = parser.LibraryPropertiesManifestParser(
"architectures=avr, esp32\n" + contents "architectures=avr, esp32\n" + contents
@ -184,7 +185,7 @@ customField=Custom Value
"type": "git", "type": "git",
} }
# Hope page # Home page
data = parser.LibraryPropertiesManifestParser( data = parser.LibraryPropertiesManifestParser(
"url=https://github.com/username/reponame.git\n" + contents "url=https://github.com/username/reponame.git\n" + contents
).as_dict() ).as_dict()
@ -193,6 +194,17 @@ customField=Custom Value
"url": "https://github.com/username/reponame.git", "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(): def test_library_json_schema():
contents = """ contents = """