Add OpenVSX source

This commit is contained in:
Th3Whit3Wolf 2021-07-14 13:05:45 +01:00
parent 46d724b465
commit ad2dc19415
3 changed files with 34 additions and 0 deletions

View file

@ -825,6 +825,17 @@ strip_release
provided
Instead of the package version, return the version this package provides. Its value is what the package provides, and ``strip_release`` takes effect too. This is best used with libraries.
Check Open Vsx
~~~~~~~~~~~~~~~
::
source = "openvsx"
Check `Open Vsx <https://open-vsx.org/>`_ for updates.
openvsx
The extension's Unique Identifier on open-vsx.org, e.g. ``ritwickdey.LiveServer``.
Combine others' results
~~~~~~~~~~~~~~~~~~~~~~~
::

View file

@ -0,0 +1,13 @@
# MIT licensed
# Copyright (c) 2013-2021 Th3Whit3Wolf <the.white.wolf.is.1337@gmail.com>, et al.
API_URL = 'https://open-vsx.org/api/%s/%s'
async def get_version(name, conf, *, cache, **kwargs):
name = conf.get('openvsx') or name
splitName = name.split('.')
publisher = splitName[0]
extension = splitName[1]
data = await cache.get_json(API_URL % (publisher, extension))
version = data['version']
return version

10
tests/test_openvsx.py Normal file
View file

@ -0,0 +1,10 @@
# MIT licensed
# Copyright (c) 2013-2021 Th3Whit3Wolf <the.white.wolf.is.1337@gmail.com>, et al.
import pytest
pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net]
async def test_openvsx(get_version):
assert await get_version("usernamehw.indent-one-space", {
"source": "openvsx",
}) == "0.2.6"