Fix lib update crashing when no libs are installed (resolve issue #19)

This commit is contained in:
Ivan Kravets
2014-10-05 23:34:40 +03:00
parent 719e03da16
commit 9ead140b6e
3 changed files with 8 additions and 2 deletions

View File

@ -6,6 +6,7 @@ Release History
* Fixed bug with order for includes in conversation from INO/PDE to CPP
* Automatic detection of port on upload (`issue #15 <https://github.com/ivankravets/platformio/issues/15>`_)
* Fixed lib update crashing when no libs are installed (`issue #19 <https://github.com/ivankravets/platformio/issues/19>`_)
0.7.0 (2014-09-24)

View File

@ -140,9 +140,12 @@ def lib_show(name):
@cli.command("update", short_help="Update installed libraries")
def lib_update():
lm = LibraryManager(get_lib_dir())
lib_names = lm.get_installed()
versions = get_api_result("/lib/version/" + ",".join(lib_names))
lib_names = lm.get_installed()
if not lib_names:
return
versions = get_api_result("/lib/version/" + ",".join(lib_names))
for name in lib_names:
info = lm.get_info(name)

View File

@ -33,6 +33,8 @@ class LibraryManager(object):
def get_installed(self):
items = []
if not isdir(self.lib_dir):
return items
for item in listdir(self.lib_dir):
conf_path = join(self.lib_dir, item, self.CONFIG_NAME)
if isfile(conf_path):