forked from platformio/platformio-core
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
|
||||
* Add support for ``.*cc`` extension
|
||||
(`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:
|
||||
return manifest
|
||||
|
||||
# if Arudino library.properties
|
||||
# if Arduino library.properties
|
||||
if "sentence" in manifest:
|
||||
manifest['frameworks'] = ["arduino"]
|
||||
manifest['description'] = manifest['sentence']
|
||||
|
@ -197,6 +197,8 @@ class PkgInstallerMixin(object):
|
||||
return name
|
||||
|
||||
def get_src_manifest_path(self, pkg_dir):
|
||||
if not isdir(pkg_dir):
|
||||
return None
|
||||
for item in os.listdir(pkg_dir):
|
||||
if not isdir(join(pkg_dir, item)):
|
||||
continue
|
||||
@ -223,20 +225,19 @@ class PkgInstallerMixin(object):
|
||||
if result:
|
||||
return result
|
||||
|
||||
manifest_path = self.get_manifest_path(pkg_dir)
|
||||
if not manifest_path:
|
||||
return None
|
||||
|
||||
# if non-registry packages: VCS or archive
|
||||
src_manifest_path = self.get_src_manifest_path(pkg_dir)
|
||||
manifest = {}
|
||||
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:
|
||||
src_manifest = util.load_json(src_manifest_path)
|
||||
|
||||
manifest = {}
|
||||
if manifest_path.endswith(".json"):
|
||||
if not manifest_path and not src_manifest_path:
|
||||
return None
|
||||
|
||||
if manifest_path and manifest_path.endswith(".json"):
|
||||
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:
|
||||
for line in fp.readlines():
|
||||
if "=" not in line:
|
||||
@ -344,7 +345,6 @@ class PkgInstallerMixin(object):
|
||||
requirements=None,
|
||||
sha1=None,
|
||||
track=False):
|
||||
pkg_dir = None
|
||||
tmp_dir = mkdtemp("-package", "_tmp_installing-", self.package_dir)
|
||||
src_manifest_dir = None
|
||||
src_manifest = {"name": name, "url": url, "requirements": requirements}
|
||||
@ -368,19 +368,19 @@ class PkgInstallerMixin(object):
|
||||
src_manifest_dir = vcs.storage_dir
|
||||
src_manifest['version'] = vcs.get_current_revision()
|
||||
|
||||
pkg_dir = self.find_pkg_root(tmp_dir)
|
||||
|
||||
# write source data to a special manifest
|
||||
_tmp_dir = tmp_dir
|
||||
if track:
|
||||
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)
|
||||
|
||||
pkg_dir = self._install_from_tmp_dir(pkg_dir, requirements)
|
||||
return self._install_from_tmp_dir(_tmp_dir, requirements)
|
||||
finally:
|
||||
if isdir(tmp_dir):
|
||||
util.rmtree_(tmp_dir)
|
||||
return pkg_dir
|
||||
return
|
||||
|
||||
def _update_src_manifest(self, data, 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/bblanchon/ArduinoJson.git",
|
||||
"https://gitlab.com/ivankravets/rs485-nodeproto.git",
|
||||
"https://github.com/platformio/platformio-libmirror.git",
|
||||
# "https://developer.mbed.org/users/simon/code/TextLCD/",
|
||||
"knolleary/pubsubclient"
|
||||
])
|
||||
@ -124,6 +125,14 @@ def test_global_install_repository(clirunner, validate_cliresult,
|
||||
]
|
||||
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):
|
||||
result = clirunner.invoke(cmd_lib, ["-g", "list"])
|
||||
@ -141,7 +150,8 @@ def test_global_lib_list(clirunner, validate_cliresult, isolated_pio_home):
|
||||
items2 = [
|
||||
"OneWire", "DHT22", "PJON", "ESPAsyncTCP", "ArduinoJson",
|
||||
"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)
|
||||
|
||||
@ -175,7 +185,7 @@ def test_global_lib_update(clirunner, validate_cliresult, isolated_pio_home):
|
||||
validate_cliresult(result)
|
||||
validate_cliresult(result)
|
||||
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 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",
|
||||
"DHT22_ID58", "ESPAsyncTCP_ID305", "NeoPixelBus_ID547", "PJON",
|
||||
"PJON@src-79de467ebe19de18287becff0a1fb42d", "PubSubClient",
|
||||
"RadioHead-1.62", "rs485-nodeproto"
|
||||
"RadioHead-1.62", "rs485-nodeproto", "platformio-libmirror"
|
||||
]
|
||||
assert set(items1) == set(items2)
|
||||
|
||||
|
Reference in New Issue
Block a user