mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-29 17:47:14 +02:00
Add support for Arm Mbed "module.json" `dependencies
` field // Resolve #3400
This commit is contained in:
@ -9,6 +9,7 @@ PlatformIO Core 4
|
||||
4.2.2 (2020-??-??)
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* Added support for Arm Mbed "module.json" ``dependencies`` field (`issue #3400 <https://github.com/platformio/platformio-core/issues/3400>`_)
|
||||
* Fixed an issue when quitting from PlatformIO IDE does not shutdown PIO Home server
|
||||
* Fixed an issue "the JSON object must be str, not 'bytes'" when PIO Home is used with Python 3.5 (`issue #3396 <https://github.com/platformio/platformio-core/issues/3396>`_)
|
||||
|
||||
|
@ -392,6 +392,8 @@ class ModuleJsonManifestParser(BaseManifestParser):
|
||||
if "licenses" in data:
|
||||
data["license"] = self._parse_license(data.get("licenses"))
|
||||
del data["licenses"]
|
||||
if "dependencies" in data:
|
||||
data["dependencies"] = self._parse_dependencies(data["dependencies"])
|
||||
return data
|
||||
|
||||
def _parse_authors(self, raw):
|
||||
@ -411,6 +413,15 @@ class ModuleJsonManifestParser(BaseManifestParser):
|
||||
return None
|
||||
return raw[0].get("type")
|
||||
|
||||
@staticmethod
|
||||
def _parse_dependencies(raw):
|
||||
if isinstance(raw, dict):
|
||||
return [
|
||||
dict(name=name, version=version, frameworks=["mbed"])
|
||||
for name, version in raw.items()
|
||||
]
|
||||
raise ManifestParserError("Invalid dependencies format, should be a dictionary")
|
||||
|
||||
|
||||
class LibraryPropertiesManifestParser(BaseManifestParser):
|
||||
manifest_type = ManifestFileType.LIBRARY_PROPERTIES
|
||||
|
@ -154,6 +154,10 @@ def test_module_json_parser():
|
||||
"url": "git@github.com:username/repo.git"
|
||||
},
|
||||
"version": "1.2.3",
|
||||
"dependencies": {
|
||||
"usefulmodule": "^1.2.3",
|
||||
"simplelog": "ARMmbed/simplelog#~0.0.1"
|
||||
},
|
||||
"customField": "Custom Value"
|
||||
}
|
||||
"""
|
||||
@ -173,6 +177,14 @@ def test_module_json_parser():
|
||||
"authors": [{"email": "name@surname.com", "name": "Name Surname"}],
|
||||
"version": "1.2.3",
|
||||
"repository": {"type": "git", "url": "git@github.com:username/repo.git"},
|
||||
"dependencies": [
|
||||
{"name": "usefulmodule", "version": "^1.2.3", "frameworks": ["mbed"]},
|
||||
{
|
||||
"name": "simplelog",
|
||||
"version": "ARMmbed/simplelog#~0.0.1",
|
||||
"frameworks": ["mbed"],
|
||||
},
|
||||
],
|
||||
"customField": "Custom Value",
|
||||
},
|
||||
)
|
||||
|
Reference in New Issue
Block a user