Ejemplo n.º 1
0
 def do_list(cls, args):
     current_sdk = sdk_manager.get_current_sdk()
     local_sdks = sdk_manager.list_local_sdks()
     local_sdk_versions = sdk_manager.list_local_sdk_versions()
     sorted_local_sdks = sorted(local_sdks, key=lambda x: version_to_key(x['version']), reverse=True)
     if len(local_sdks) > 0:
         print("Installed SDKs:")
         for sdk in sorted_local_sdks:
             line = sdk['version']
             if sdk['channel']:
                 line += " ({})".format(sdk['channel'])
             if sdk['version'] == current_sdk:
                 line += " (active)"
             print(line)
         print()
     else:
         print("No SDKs installed yet.")
     if sdk_manager.get_channel() != '':
         channel_text = ' ({} channel)'.format(sdk_manager.get_channel())
     else:
         channel_text = ''
     print("Available SDKs{}:".format(channel_text))
     try:
         for sdk in sdk_manager.list_remote_sdks():
             if sdk['version'] in local_sdk_versions:
                 continue
             line = sdk['version']
             if sdk['channel']:
                 line += " ({})".format(sdk['channel'])
             if sdk['version'] == current_sdk:
                 line += " (active)"
             print(line)
     except requests.RequestException:
         print("Could not fetch list of available SDKs.")
Ejemplo n.º 2
0
def _handle_sdk_update(version, release_notes=None):
    # We know the SDK was new when the version check occurred, but it is possible that it's
    # been installed since then. Therefore, check again.
    if version not in sdk_manager.list_local_sdk_versions():
        _print()
        _print("A new SDK, version {0}, is available! Run `pebble sdk install {0}` to get it.".format(version))
        if release_notes is not None:
            _print(release_notes)
Ejemplo n.º 3
0
def _do_updates():
    _checkers.append(UpdateChecker("pebble-tool-{}".format(_get_platform()), __version__, _handle_tool_update))
    # Only do the SDK update check if there is actually an SDK installed.
    if sdk_manager.get_current_sdk() is not None:
        try:
            latest_sdk = max(sdk_manager.list_local_sdk_versions(), key=version_to_key)
        except ValueError:
            latest_sdk = "0"
        _checkers.append(UpdateChecker("sdk-core", latest_sdk, _handle_sdk_update))
Ejemplo n.º 4
0
def _handle_sdk_update(version, release_notes=None):
    # We know the SDK was new when the version check occurred, but it is possible that it's
    # been installed since then. Therefore, check again.
    if version not in sdk_manager.list_local_sdk_versions():
        _print()
        _print(
            "A new SDK, version {0}, is available! Run `pebble sdk install {0}` to get it."
            .format(version))
        if release_notes is not None:
            _print(release_notes)
Ejemplo n.º 5
0
def _do_updates():
    _checkers.append(
        UpdateChecker("pebble-tool-{}".format(_get_platform()), __version__,
                      _handle_tool_update))
    # Only do the SDK update check if there is actually an SDK installed.
    if sdk_manager.get_current_sdk() is not None:
        try:
            latest_sdk = max(sdk_manager.list_local_sdk_versions(),
                             key=version_to_key)
        except ValueError:
            latest_sdk = "0"
        _checkers.append(
            UpdateChecker("sdk-core", latest_sdk, _handle_sdk_update))
Ejemplo n.º 6
0
 def do_list(cls, args):
     current_sdk = sdk_manager.get_current_sdk()
     local_sdks = sdk_manager.list_local_sdks()
     local_sdk_versions = sdk_manager.list_local_sdk_versions()
     sorted_local_sdks = sorted(local_sdks,
                                key=lambda x: version_to_key(x['version']),
                                reverse=True)
     if len(local_sdks) > 0:
         print("Installed SDKs:")
         for sdk in sorted_local_sdks:
             line = sdk['version']
             if sdk['channel']:
                 line += " ({})".format(sdk['channel'])
             if sdk['version'] == current_sdk:
                 line += " (active)"
             print(line)
         print()
     else:
         print("No SDKs installed yet.")
     if sdk_manager.get_channel() != '':
         channel_text = ' ({} channel)'.format(sdk_manager.get_channel())
     else:
         channel_text = ''
     print("Available SDKs{}:".format(channel_text))
     try:
         for sdk in sdk_manager.list_remote_sdks():
             if sdk['version'] in local_sdk_versions:
                 continue
             line = sdk['version']
             if sdk['channel']:
                 line += " ({})".format(sdk['channel'])
             if sdk['version'] == current_sdk:
                 line += " (active)"
             print(line)
     except requests.RequestException:
         print("Could not fetch list of available SDKs.")