mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-30 10:07:14 +02:00
Fixed infinite dependency installing when repository consists of multiple libraries // Resolve #935
This commit is contained in:
@ -17,6 +17,9 @@ PlatformIO 3.0
|
|||||||
that were installed from repository
|
that were installed from repository
|
||||||
* Add support for ``.*cc`` extension
|
* Add support for ``.*cc`` extension
|
||||||
(`issue #939 <https://github.com/platformio/platformio-core/issues/939>`_)
|
(`issue #939 <https://github.com/platformio/platformio-core/issues/939>`_)
|
||||||
|
* Fixed infinite dependency installing when repository consists of multiple
|
||||||
|
libraries
|
||||||
|
(`issue #935 <https://github.com/platformio/platformio-core/issues/935>`_)
|
||||||
|
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ class LibraryManager(BasePkgManager):
|
|||||||
if not manifest:
|
if not manifest:
|
||||||
return manifest
|
return manifest
|
||||||
|
|
||||||
# if Arudino library.properties
|
# if Arduino library.properties
|
||||||
if "sentence" in manifest:
|
if "sentence" in manifest:
|
||||||
manifest['frameworks'] = ["arduino"]
|
manifest['frameworks'] = ["arduino"]
|
||||||
manifest['description'] = manifest['sentence']
|
manifest['description'] = manifest['sentence']
|
||||||
|
@ -197,6 +197,8 @@ class PkgInstallerMixin(object):
|
|||||||
return name
|
return name
|
||||||
|
|
||||||
def get_src_manifest_path(self, pkg_dir):
|
def get_src_manifest_path(self, pkg_dir):
|
||||||
|
if not isdir(pkg_dir):
|
||||||
|
return None
|
||||||
for item in os.listdir(pkg_dir):
|
for item in os.listdir(pkg_dir):
|
||||||
if not isdir(join(pkg_dir, item)):
|
if not isdir(join(pkg_dir, item)):
|
||||||
continue
|
continue
|
||||||
@ -223,20 +225,19 @@ class PkgInstallerMixin(object):
|
|||||||
if result:
|
if result:
|
||||||
return result
|
return result
|
||||||
|
|
||||||
manifest_path = self.get_manifest_path(pkg_dir)
|
manifest = {}
|
||||||
if not manifest_path:
|
|
||||||
return None
|
|
||||||
|
|
||||||
# if non-registry packages: VCS or archive
|
|
||||||
src_manifest_path = self.get_src_manifest_path(pkg_dir)
|
|
||||||
src_manifest = None
|
src_manifest = None
|
||||||
|
manifest_path = self.get_manifest_path(pkg_dir)
|
||||||
|
src_manifest_path = self.get_src_manifest_path(pkg_dir)
|
||||||
if src_manifest_path:
|
if src_manifest_path:
|
||||||
src_manifest = util.load_json(src_manifest_path)
|
src_manifest = util.load_json(src_manifest_path)
|
||||||
|
|
||||||
manifest = {}
|
if not manifest_path and not src_manifest_path:
|
||||||
if manifest_path.endswith(".json"):
|
return None
|
||||||
|
|
||||||
|
if manifest_path and manifest_path.endswith(".json"):
|
||||||
manifest = util.load_json(manifest_path)
|
manifest = util.load_json(manifest_path)
|
||||||
elif manifest_path.endswith(".properties"):
|
elif manifest_path and manifest_path.endswith(".properties"):
|
||||||
with codecs.open(manifest_path, encoding="utf-8") as fp:
|
with codecs.open(manifest_path, encoding="utf-8") as fp:
|
||||||
for line in fp.readlines():
|
for line in fp.readlines():
|
||||||
if "=" not in line:
|
if "=" not in line:
|
||||||
@ -344,7 +345,6 @@ class PkgInstallerMixin(object):
|
|||||||
requirements=None,
|
requirements=None,
|
||||||
sha1=None,
|
sha1=None,
|
||||||
track=False):
|
track=False):
|
||||||
pkg_dir = None
|
|
||||||
tmp_dir = mkdtemp("-package", "_tmp_installing-", self.package_dir)
|
tmp_dir = mkdtemp("-package", "_tmp_installing-", self.package_dir)
|
||||||
src_manifest_dir = None
|
src_manifest_dir = None
|
||||||
src_manifest = {"name": name, "url": url, "requirements": requirements}
|
src_manifest = {"name": name, "url": url, "requirements": requirements}
|
||||||
@ -368,19 +368,19 @@ class PkgInstallerMixin(object):
|
|||||||
src_manifest_dir = vcs.storage_dir
|
src_manifest_dir = vcs.storage_dir
|
||||||
src_manifest['version'] = vcs.get_current_revision()
|
src_manifest['version'] = vcs.get_current_revision()
|
||||||
|
|
||||||
pkg_dir = self.find_pkg_root(tmp_dir)
|
|
||||||
|
|
||||||
# write source data to a special manifest
|
# write source data to a special manifest
|
||||||
|
_tmp_dir = tmp_dir
|
||||||
if track:
|
if track:
|
||||||
if not src_manifest_dir:
|
if not src_manifest_dir:
|
||||||
src_manifest_dir = join(pkg_dir, ".pio")
|
_tmp_dir = self.find_pkg_root(tmp_dir)
|
||||||
|
src_manifest_dir = join(_tmp_dir, ".pio")
|
||||||
self._update_src_manifest(src_manifest, src_manifest_dir)
|
self._update_src_manifest(src_manifest, src_manifest_dir)
|
||||||
|
|
||||||
pkg_dir = self._install_from_tmp_dir(pkg_dir, requirements)
|
return self._install_from_tmp_dir(_tmp_dir, requirements)
|
||||||
finally:
|
finally:
|
||||||
if isdir(tmp_dir):
|
if isdir(tmp_dir):
|
||||||
util.rmtree_(tmp_dir)
|
util.rmtree_(tmp_dir)
|
||||||
return pkg_dir
|
return
|
||||||
|
|
||||||
def _update_src_manifest(self, data, src_dir):
|
def _update_src_manifest(self, data, src_dir):
|
||||||
if not isdir(src_dir):
|
if not isdir(src_dir):
|
||||||
|
@ -112,6 +112,7 @@ def test_global_install_repository(clirunner, validate_cliresult,
|
|||||||
"https://github.com/gioblu/PJON.git#6.2",
|
"https://github.com/gioblu/PJON.git#6.2",
|
||||||
"https://github.com/bblanchon/ArduinoJson.git",
|
"https://github.com/bblanchon/ArduinoJson.git",
|
||||||
"https://gitlab.com/ivankravets/rs485-nodeproto.git",
|
"https://gitlab.com/ivankravets/rs485-nodeproto.git",
|
||||||
|
"https://github.com/platformio/platformio-libmirror.git",
|
||||||
# "https://developer.mbed.org/users/simon/code/TextLCD/",
|
# "https://developer.mbed.org/users/simon/code/TextLCD/",
|
||||||
"knolleary/pubsubclient"
|
"knolleary/pubsubclient"
|
||||||
])
|
])
|
||||||
@ -124,6 +125,14 @@ def test_global_install_repository(clirunner, validate_cliresult,
|
|||||||
]
|
]
|
||||||
assert set(items1) >= set(items2)
|
assert set(items1) >= set(items2)
|
||||||
|
|
||||||
|
# check lib with duplicate URL
|
||||||
|
result = clirunner.invoke(cmd_lib, [
|
||||||
|
"-g", "install",
|
||||||
|
"https://github.com/platformio/platformio-libmirror.git"
|
||||||
|
])
|
||||||
|
validate_cliresult(result)
|
||||||
|
assert "is already installed" in result.output
|
||||||
|
|
||||||
|
|
||||||
def test_global_lib_list(clirunner, validate_cliresult, isolated_pio_home):
|
def test_global_lib_list(clirunner, validate_cliresult, isolated_pio_home):
|
||||||
result = clirunner.invoke(cmd_lib, ["-g", "list"])
|
result = clirunner.invoke(cmd_lib, ["-g", "list"])
|
||||||
@ -141,7 +150,8 @@ def test_global_lib_list(clirunner, validate_cliresult, isolated_pio_home):
|
|||||||
items2 = [
|
items2 = [
|
||||||
"OneWire", "DHT22", "PJON", "ESPAsyncTCP", "ArduinoJson",
|
"OneWire", "DHT22", "PJON", "ESPAsyncTCP", "ArduinoJson",
|
||||||
"PubSubClient", "rs485-nodeproto", "Adafruit ST7735 Library",
|
"PubSubClient", "rs485-nodeproto", "Adafruit ST7735 Library",
|
||||||
"RadioHead-1.62", "DallasTemperature", "NeoPixelBus", "IRremoteESP8266"
|
"RadioHead-1.62", "DallasTemperature", "NeoPixelBus",
|
||||||
|
"IRremoteESP8266", "platformio-libmirror"
|
||||||
]
|
]
|
||||||
assert set(items1) == set(items2)
|
assert set(items1) == set(items2)
|
||||||
|
|
||||||
@ -175,7 +185,7 @@ def test_global_lib_update(clirunner, validate_cliresult, isolated_pio_home):
|
|||||||
validate_cliresult(result)
|
validate_cliresult(result)
|
||||||
validate_cliresult(result)
|
validate_cliresult(result)
|
||||||
assert result.output.count("[Skip]") == 5
|
assert result.output.count("[Skip]") == 5
|
||||||
assert result.output.count("[Up-to-date]") == 9
|
assert result.output.count("[Up-to-date]") == 10
|
||||||
assert "Uninstalling ArduinoJson @ 5.7.3" in result.output
|
assert "Uninstalling ArduinoJson @ 5.7.3" in result.output
|
||||||
assert "Uninstalling IRremoteESP8266 @ fee16e880b" in result.output
|
assert "Uninstalling IRremoteESP8266 @ fee16e880b" in result.output
|
||||||
|
|
||||||
@ -208,7 +218,7 @@ def test_global_lib_uninstall(clirunner, validate_cliresult,
|
|||||||
"ArduinoJson", "ArduinoJson_ID64@5.6.7", "DallasTemperature_ID54",
|
"ArduinoJson", "ArduinoJson_ID64@5.6.7", "DallasTemperature_ID54",
|
||||||
"DHT22_ID58", "ESPAsyncTCP_ID305", "NeoPixelBus_ID547", "PJON",
|
"DHT22_ID58", "ESPAsyncTCP_ID305", "NeoPixelBus_ID547", "PJON",
|
||||||
"PJON@src-79de467ebe19de18287becff0a1fb42d", "PubSubClient",
|
"PJON@src-79de467ebe19de18287becff0a1fb42d", "PubSubClient",
|
||||||
"RadioHead-1.62", "rs485-nodeproto"
|
"RadioHead-1.62", "rs485-nodeproto", "platformio-libmirror"
|
||||||
]
|
]
|
||||||
assert set(items1) == set(items2)
|
assert set(items1) == set(items2)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user