Exemple #1
0
def get_editors(tunnel: Tunnel = None):
    """
    Get AttributeDict of SupportedEditors.

    Builds an AttributeDict of data about each of the support VSCode editor
    variations on the current system.

    Keyword Arguments:
        tunnel {Tunnel} -- An SSH tunnel connection, which is used to make
        remote requests as part of building the editor information

    Returns
        AttributeDict

    """
    return AttributeDict({
        'code':
        SupportedEditor(
            command=SupportedEditorCommands.code,
            editor_id='VSCode',
            home_dirname='.vscode',
            remote_alias='stable',
            tunnel=tunnel,
        ),
        'insiders':
        SupportedEditor(
            command=SupportedEditorCommands.insiders,
            editor_id='VSCode Insiders',
            home_dirname='.vscode-insiders',
            remote_alias='insider',
            tunnel=tunnel,
        ),
        'exploration':
        SupportedEditor(
            command=SupportedEditorCommands.exploration,
            editor_id='VSCode Exploration',
            home_dirname='.vscode-exploration',
            remote_alias='exploration',
            tunnel=tunnel,
        ),
        'codium':
        SupportedEditor(
            command=SupportedEditorCommands.codium,
            editor_id='VSCodium',
            home_dirname='.vscode-oss',
            remote_alias='codium',
            tunnel=tunnel,
            api_root_url=
            'https://api.github.com/repos/VSCodium/vscodium/releases/latest',
            github_ext_pattern=platform_query(darwin='dmg',
                                              windows='exe',
                                              linux='AppImage',
                                              rpm='rpm',
                                              deb='deb'))
    })
Exemple #2
0
# https://github.com/microsoft/vscode-cpptools/issues/5290

# TODO: Check into options for things like:
# - platform-specified vsix extensions
# - check dependencies via the install.lock file (https://github.com/microsoft/vscode-cpptools/issues/4778#issuecomment-568125545)

_NON_MARKETPLACE_EXTENSIONS = AttributeDict({
    'ms-vscode.cpptools':
    AttributeDict({
        'owner':
        'Microsoft',
        'repo':
        'vscode-cpptools',
        'asset_name':
        platform_query(windows='cpptools-win32.vsix',
                       darwin='cpptools-osx.vsix',
                       linux64='cpptools-linux.vsix',
                       linux32='cpptools-linux32.vsix')
    })
})

_LOGGER = get_rich_logger(__name__)
_REQUEST_CURLER = CurledRequest()


class Extension:
    """Extension base class"""
    def __init__(self, tunnel=None, **kwargs):
        self.tunnel = tunnel
        self.unique_id = kwargs.get('unique_id')
        self.download_url = kwargs.get('download_url')
        self.should_download_from_marketplace = \
Exemple #3
0
_ENCODING = 'utf-8'
_EXTENSION_ATTRIBUTES_RE = re.compile(r'^(?P<unique_id>.*?^'
                                      r'(?P<publisher>.*?)\.'
                                      r'(?P<package>.*))\@(?P<version>.*)')

_GITHUB_EDITOR_UPDATE_ROOT_URL = 'https://api.github.com'
_MARKETPLACE_EDITOR_UPDATE_ROOT_URL = 'https://update.code.visualstudio.com/api/update'

# These represent the query patterns for the different vscode editors based
# on the system platform and architecture.
_MARKETPLACE_EDITOR_DISTRO_PATTERN = platform_query(windows='win32-x64',
                                                    win32='win32',
                                                    darwin='darwin',
                                                    linux='linux-x64',
                                                    linux32='linux-ia32',
                                                    rpm='linux-rpm-64',
                                                    rpm32='linux-rpm-ia32',
                                                    deb='linux-deb-x64',
                                                    deb32='linux-deb-ia32')

_LOGGER = get_rich_logger(__name__)
_curled = CurledRequest()

SupportedEditorCommands = AttributeDict({
    'code': 'code',
    'insiders': 'code-insiders',
    'exploration': 'code-exploration',
    'codium': 'codium',
})