mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-30 10:07: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)
|
return (None, None)
|
||||||
name = raw
|
name = raw
|
||||||
email = None
|
email = None
|
||||||
for ldel, rdel in [("<", ">"), ("(", ")")]:
|
ldel = "<"
|
||||||
if ldel in raw and rdel in raw:
|
rdel = ">"
|
||||||
name = raw[: raw.index(ldel)]
|
if ldel in raw and rdel in raw:
|
||||||
email = raw[raw.index(ldel) + 1 : raw.index(rdel)]
|
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)
|
return (name.strip(), email.strip() if email else None)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -198,7 +198,7 @@ def test_library_properties_parser():
|
|||||||
contents = """
|
contents = """
|
||||||
name=TestPackage
|
name=TestPackage
|
||||||
version=1.2.3
|
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
|
sentence=This is Arduino library
|
||||||
customField=Custom Value
|
customField=Custom Value
|
||||||
depends=First Library (=2.0.0), Second Library (>=1.2.0), Third
|
depends=First Library (=2.0.0), Second Library (>=1.2.0), Third
|
||||||
@ -218,7 +218,10 @@ ignore_empty_field=
|
|||||||
"export": {
|
"export": {
|
||||||
"exclude": ["extras", "docs", "tests", "test", "*.doxyfile", "*.pdf"]
|
"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"],
|
"keywords": ["uncategorized"],
|
||||||
"customField": "Custom Value",
|
"customField": "Custom Value",
|
||||||
"depends": "First Library (=2.0.0), Second Library (>=1.2.0), Third",
|
"depends": "First Library (=2.0.0), Second Library (>=1.2.0), Third",
|
||||||
|
Reference in New Issue
Block a user