mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-29 17:47:14 +02:00
Improve parsing "author" field of library.properties manfiest
This commit is contained in:
@ -198,10 +198,13 @@ class BaseManifestParser(object):
|
||||
return (None, None)
|
||||
name = raw
|
||||
email = None
|
||||
for ldel, rdel in [("<", ">"), ("(", ")")]:
|
||||
if ldel in raw and rdel in raw:
|
||||
name = raw[: raw.index(ldel)]
|
||||
email = raw[raw.index(ldel) + 1 : raw.index(rdel)]
|
||||
ldel = "<"
|
||||
rdel = ">"
|
||||
if ldel in raw and rdel in raw:
|
||||
name = raw[: raw.index(ldel)]
|
||||
email = raw[raw.index(ldel) + 1 : raw.index(rdel)]
|
||||
if "(" in name:
|
||||
name = name.split("(")[0]
|
||||
return (name.strip(), email.strip() if email else None)
|
||||
|
||||
@staticmethod
|
||||
|
@ -198,7 +198,7 @@ def test_library_properties_parser():
|
||||
contents = """
|
||||
name=TestPackage
|
||||
version=1.2.3
|
||||
author=SomeAuthor <info AT author.com>
|
||||
author=SomeAuthor <info AT author.com>, Another Author (nickname) <www.example.com>
|
||||
sentence=This is Arduino library
|
||||
customField=Custom Value
|
||||
depends=First Library (=2.0.0), Second Library (>=1.2.0), Third
|
||||
@ -218,7 +218,10 @@ ignore_empty_field=
|
||||
"export": {
|
||||
"exclude": ["extras", "docs", "tests", "test", "*.doxyfile", "*.pdf"]
|
||||
},
|
||||
"authors": [{"email": "info@author.com", "name": "SomeAuthor"}],
|
||||
"authors": [
|
||||
{"email": "info@author.com", "name": "SomeAuthor"},
|
||||
{"name": "Another Author"},
|
||||
],
|
||||
"keywords": ["uncategorized"],
|
||||
"customField": "Custom Value",
|
||||
"depends": "First Library (=2.0.0), Second Library (>=1.2.0), Third",
|
||||
|
Reference in New Issue
Block a user