mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-31 02:27:13 +02:00
Improved support for Arduino "library.properties" `depends
` field
This commit is contained in:
@ -10,6 +10,7 @@ PlatformIO Core 4
|
|||||||
~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
* Added support for Arm Mbed "module.json" ``dependencies`` field (`issue #3400 <https://github.com/platformio/platformio-core/issues/3400>`_)
|
* Added support for Arm Mbed "module.json" ``dependencies`` field (`issue #3400 <https://github.com/platformio/platformio-core/issues/3400>`_)
|
||||||
|
* Improved support for Arduino "library.properties" ``depends`` field
|
||||||
* Fixed an issue when quitting from PlatformIO IDE does not shutdown PIO Home server
|
* 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>`_)
|
* 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>`_)
|
||||||
* Fixed an issue when Python 2 does not keep encoding when converting ".ino" (`issue #3393 <https://github.com/platformio/platformio-core/issues/3393>`_)
|
* Fixed an issue when Python 2 does not keep encoding when converting ".ino" (`issue #3393 <https://github.com/platformio/platformio-core/issues/3393>`_)
|
||||||
|
@ -26,6 +26,8 @@ from platformio import app, exception, util
|
|||||||
from platformio.compat import glob_escape
|
from platformio.compat import glob_escape
|
||||||
from platformio.managers.package import BasePkgManager
|
from platformio.managers.package import BasePkgManager
|
||||||
from platformio.managers.platform import PlatformFactory, PlatformManager
|
from platformio.managers.platform import PlatformFactory, PlatformManager
|
||||||
|
from platformio.package.exception import ManifestException
|
||||||
|
from platformio.package.manifest.parser import ManifestParserFactory
|
||||||
from platformio.project.config import ProjectConfig
|
from platformio.project.config import ProjectConfig
|
||||||
|
|
||||||
|
|
||||||
@ -281,8 +283,12 @@ class LibraryManager(BasePkgManager):
|
|||||||
if not pkg_dir:
|
if not pkg_dir:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
manifest = self.load_manifest(pkg_dir)
|
manifest = None
|
||||||
if "dependencies" not in manifest:
|
try:
|
||||||
|
manifest = ManifestParserFactory.new_from_dir(pkg_dir).as_dict()
|
||||||
|
except ManifestException:
|
||||||
|
pass
|
||||||
|
if not manifest or not manifest.get("dependencies"):
|
||||||
return pkg_dir
|
return pkg_dir
|
||||||
|
|
||||||
if not silent:
|
if not silent:
|
||||||
|
@ -44,7 +44,7 @@ def test_global_install_registry(clirunner, validate_cliresult, isolated_pio_hom
|
|||||||
"ArduinoJson@~5.10.0",
|
"ArduinoJson@~5.10.0",
|
||||||
"547@2.2.4",
|
"547@2.2.4",
|
||||||
"AsyncMqttClient@<=0.8.2",
|
"AsyncMqttClient@<=0.8.2",
|
||||||
"999@77d4eb3f8a",
|
"Adafruit PN532@1.2.0",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
validate_cliresult(result)
|
validate_cliresult(result)
|
||||||
@ -62,7 +62,8 @@ def test_global_install_registry(clirunner, validate_cliresult, isolated_pio_hom
|
|||||||
"AsyncMqttClient_ID346",
|
"AsyncMqttClient_ID346",
|
||||||
"ESPAsyncTCP_ID305",
|
"ESPAsyncTCP_ID305",
|
||||||
"AsyncTCP_ID1826",
|
"AsyncTCP_ID1826",
|
||||||
"RFcontrol_ID999",
|
"Adafruit PN532_ID29",
|
||||||
|
"Adafruit BusIO_ID6214",
|
||||||
]
|
]
|
||||||
assert set(items1) == set(items2)
|
assert set(items1) == set(items2)
|
||||||
|
|
||||||
@ -135,7 +136,7 @@ def test_install_duplicates(clirunner, validate_cliresult, without_internet):
|
|||||||
assert "is already installed" in result.output
|
assert "is already installed" in result.output
|
||||||
|
|
||||||
# by ID
|
# by ID
|
||||||
result = clirunner.invoke(cmd_lib, ["-g", "install", "999"])
|
result = clirunner.invoke(cmd_lib, ["-g", "install", "29"])
|
||||||
validate_cliresult(result)
|
validate_cliresult(result)
|
||||||
assert "is already installed" in result.output
|
assert "is already installed" in result.output
|
||||||
|
|
||||||
@ -202,7 +203,8 @@ def test_global_lib_list(clirunner, validate_cliresult):
|
|||||||
"PJON",
|
"PJON",
|
||||||
"PJON",
|
"PJON",
|
||||||
"PubSubClient",
|
"PubSubClient",
|
||||||
"RFcontrol",
|
"Adafruit PN532",
|
||||||
|
"Adafruit BusIO",
|
||||||
"platformio-libmirror",
|
"platformio-libmirror",
|
||||||
"rs485-nodeproto",
|
"rs485-nodeproto",
|
||||||
]
|
]
|
||||||
@ -219,7 +221,7 @@ def test_global_lib_list(clirunner, validate_cliresult):
|
|||||||
"PJON@07fe9aa",
|
"PJON@07fe9aa",
|
||||||
"PJON@1fb26fd",
|
"PJON@1fb26fd",
|
||||||
"PubSubClient@bef5814",
|
"PubSubClient@bef5814",
|
||||||
"RFcontrol@77d4eb3f8a",
|
"Adafruit PN532@1.2.0",
|
||||||
]
|
]
|
||||||
assert set(versions1) >= set(versions2)
|
assert set(versions1) >= set(versions2)
|
||||||
|
|
||||||
@ -230,9 +232,7 @@ def test_global_lib_update_check(clirunner, validate_cliresult):
|
|||||||
)
|
)
|
||||||
validate_cliresult(result)
|
validate_cliresult(result)
|
||||||
output = json.loads(result.output)
|
output = json.loads(result.output)
|
||||||
assert set(["RFcontrol", "ESPAsyncTCP", "NeoPixelBus"]) == set(
|
assert set(["ESPAsyncTCP", "NeoPixelBus"]) == set([l["name"] for l in output])
|
||||||
[l["name"] for l in output]
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def test_global_lib_update(clirunner, validate_cliresult):
|
def test_global_lib_update(clirunner, validate_cliresult):
|
||||||
@ -252,8 +252,7 @@ def test_global_lib_update(clirunner, validate_cliresult):
|
|||||||
result = clirunner.invoke(cmd_lib, ["-g", "update"])
|
result = clirunner.invoke(cmd_lib, ["-g", "update"])
|
||||||
validate_cliresult(result)
|
validate_cliresult(result)
|
||||||
assert result.output.count("[Detached]") == 5
|
assert result.output.count("[Detached]") == 5
|
||||||
assert result.output.count("[Up-to-date]") == 10
|
assert result.output.count("[Up-to-date]") == 12
|
||||||
assert "Uninstalling RFcontrol @ 77d4eb3f8a" in result.output
|
|
||||||
|
|
||||||
# update unknown library
|
# update unknown library
|
||||||
result = clirunner.invoke(cmd_lib, ["-g", "update", "Unknown"])
|
result = clirunner.invoke(cmd_lib, ["-g", "update", "Unknown"])
|
||||||
@ -266,9 +265,10 @@ def test_global_lib_uninstall(clirunner, validate_cliresult, isolated_pio_home):
|
|||||||
result = clirunner.invoke(cmd_lib, ["-g", "list", "--json-output"])
|
result = clirunner.invoke(cmd_lib, ["-g", "list", "--json-output"])
|
||||||
validate_cliresult(result)
|
validate_cliresult(result)
|
||||||
items = json.loads(result.output)
|
items = json.loads(result.output)
|
||||||
result = clirunner.invoke(cmd_lib, ["-g", "uninstall", items[5]["__pkg_dir"]])
|
items = sorted(items, key=lambda item: item["__pkg_dir"])
|
||||||
|
result = clirunner.invoke(cmd_lib, ["-g", "uninstall", items[0]["__pkg_dir"]])
|
||||||
validate_cliresult(result)
|
validate_cliresult(result)
|
||||||
assert "Uninstalling AsyncTCP" in result.output
|
assert ("Uninstalling %s" % items[0]["name"]) in result.output
|
||||||
|
|
||||||
# uninstall the rest libraries
|
# uninstall the rest libraries
|
||||||
result = clirunner.invoke(
|
result = clirunner.invoke(
|
||||||
@ -279,7 +279,7 @@ def test_global_lib_uninstall(clirunner, validate_cliresult, isolated_pio_home):
|
|||||||
"1",
|
"1",
|
||||||
"https://github.com/bblanchon/ArduinoJson.git",
|
"https://github.com/bblanchon/ArduinoJson.git",
|
||||||
"ArduinoJson@!=5.6.7",
|
"ArduinoJson@!=5.6.7",
|
||||||
"RFcontrol",
|
"Adafruit PN532",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
validate_cliresult(result)
|
validate_cliresult(result)
|
||||||
@ -291,13 +291,14 @@ def test_global_lib_uninstall(clirunner, validate_cliresult, isolated_pio_home):
|
|||||||
"PubSubClient",
|
"PubSubClient",
|
||||||
"ArduinoJson@src-69ebddd821f771debe7ee734d3c7fa81",
|
"ArduinoJson@src-69ebddd821f771debe7ee734d3c7fa81",
|
||||||
"ESPAsyncTCP_ID305",
|
"ESPAsyncTCP_ID305",
|
||||||
"SomeLib_ID54",
|
"ESP32WebServer",
|
||||||
"NeoPixelBus_ID547",
|
"NeoPixelBus_ID547",
|
||||||
"PJON",
|
"PJON",
|
||||||
"AsyncMqttClient_ID346",
|
"AsyncMqttClient_ID346",
|
||||||
"ArduinoJson_ID64",
|
"ArduinoJson_ID64",
|
||||||
|
"SomeLib_ID54",
|
||||||
"PJON@src-79de467ebe19de18287becff0a1fb42d",
|
"PJON@src-79de467ebe19de18287becff0a1fb42d",
|
||||||
"ESP32WebServer",
|
"AsyncTCP_ID1826",
|
||||||
]
|
]
|
||||||
assert set(items1) == set(items2)
|
assert set(items1) == set(items2)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user