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 do_include_path(cls, args):
     sdk = args.sdk or sdk_manager.get_current_sdk()
     path = sdk_manager.path_for_sdk(sdk)
     path = os.path.join(path, "pebble", args.platform, "include")
     if not os.path.exists(path):
         raise MissingSDK("No platform '{}' available for SDK {}".format(args.platform, sdk))
     print(path)
Ejemplo n.º 3
0
 def do_include_path(cls, args):
     sdk = args.sdk or sdk_manager.get_current_sdk()
     path = sdk_manager.path_for_sdk(sdk)
     path = os.path.join(path, "pebble", args.platform, "include")
     if not os.path.exists(path):
         raise MissingSDK("No platform '{}' available for SDK {}".format(
             args.platform, sdk))
     print(path)
Ejemplo n.º 4
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.º 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.")
Ejemplo n.º 7
0
 def do_activate(cls, args):
     sdk_manager.set_current_sdk(args.version)
     print("Set active SDK to {}.".format(sdk_manager.get_current_sdk()))
Ejemplo n.º 8
0
 def do_activate(cls, args):
     sdk_manager.set_current_sdk(args.version)
     print("Set active SDK to {}.".format(sdk_manager.get_current_sdk()))