mirror of
https://github.com/lilydjwg/nvchecker.git
synced 2025-03-10 06:14:02 +00:00
Add channel
for Android SDK packages
This commit is contained in:
parent
d4b07d67b8
commit
ea1200126b
3 changed files with 26 additions and 1 deletions
|
@ -591,6 +591,9 @@ android_sdk
|
||||||
repo
|
repo
|
||||||
Should be one of ``addon`` or ``package``. Packages in ``addon2-1.xml`` use ``addon`` and packages in ``repository2-1.xml`` use ``package``.
|
Should be one of ``addon`` or ``package``. Packages in ``addon2-1.xml`` use ``addon`` and packages in ``repository2-1.xml`` use ``package``.
|
||||||
|
|
||||||
|
channel
|
||||||
|
Choose the target channel from one of ``stable``, ``beta``, ``dev`` or ``canary``. This option also accepts a comma-seperated list to pick from multiple channels. For example, the latest unstable version is picked with ``beta,dev,canary``.
|
||||||
|
|
||||||
Check Sparkle framework
|
Check Sparkle framework
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
::
|
::
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# MIT licensed
|
# MIT licensed
|
||||||
# Copyright (c) 2020 lilydjwg <lilydjwg@gmail.com>, et al.
|
# Copyright (c) 2020 lilydjwg <lilydjwg@gmail.com>, et al.
|
||||||
# Copyright (c) 2017 Chih-Hsuan Yen <yan12125 at gmail dot com>
|
# Copyright (c) 2017,2020 Chih-Hsuan Yen <yan12125 at gmail dot com>
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
@ -13,6 +13,14 @@ _ANDROID_REPO_MANIFESTS = {
|
||||||
'package': 'https://dl.google.com/android/repository/repository2-1.xml',
|
'package': 'https://dl.google.com/android/repository/repository2-1.xml',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# See <channel> tags in Android SDK XML manifests
|
||||||
|
_CHANNEL_MAP = {
|
||||||
|
'stable': 'channel-0',
|
||||||
|
'beta': 'channel-1',
|
||||||
|
'dev': 'channel-2',
|
||||||
|
'canary': 'channel-3',
|
||||||
|
}
|
||||||
|
|
||||||
async def _get_repo_manifest(repo):
|
async def _get_repo_manifest(repo):
|
||||||
repo_xml_url = _ANDROID_REPO_MANIFESTS[repo]
|
repo_xml_url = _ANDROID_REPO_MANIFESTS[repo]
|
||||||
|
|
||||||
|
@ -25,12 +33,17 @@ async def _get_repo_manifest(repo):
|
||||||
async def get_version(name, conf, *, cache, **kwargs):
|
async def get_version(name, conf, *, cache, **kwargs):
|
||||||
repo = conf['repo']
|
repo = conf['repo']
|
||||||
pkg_path_prefix = conf['android_sdk']
|
pkg_path_prefix = conf['android_sdk']
|
||||||
|
channels = [_CHANNEL_MAP[channel]
|
||||||
|
for channel in conf.get('channel', 'stable').split(',')]
|
||||||
|
|
||||||
repo_manifest = await cache.get(repo, _get_repo_manifest)
|
repo_manifest = await cache.get(repo, _get_repo_manifest)
|
||||||
|
|
||||||
for pkg in repo_manifest.findall('.//remotePackage'):
|
for pkg in repo_manifest.findall('.//remotePackage'):
|
||||||
if not pkg.attrib['path'].startswith(pkg_path_prefix):
|
if not pkg.attrib['path'].startswith(pkg_path_prefix):
|
||||||
continue
|
continue
|
||||||
|
channelRef = pkg.find('./channelRef')
|
||||||
|
if channelRef.attrib['ref'] not in channels:
|
||||||
|
continue
|
||||||
for archive in pkg.findall('./archives/archive'):
|
for archive in pkg.findall('./archives/archive'):
|
||||||
host_os = archive.find('./host-os')
|
host_os = archive.find('./host-os')
|
||||||
if host_os is not None and host_os.text != 'linux':
|
if host_os is not None and host_os.text != 'linux':
|
||||||
|
|
|
@ -17,4 +17,13 @@ async def test_android_package(get_version):
|
||||||
"source": "android_sdk",
|
"source": "android_sdk",
|
||||||
"android_sdk": "cmake;",
|
"android_sdk": "cmake;",
|
||||||
"repo": "package",
|
"repo": "package",
|
||||||
|
}) == "3.6.4111459"
|
||||||
|
|
||||||
|
|
||||||
|
async def test_android_package_channel(get_version):
|
||||||
|
assert await get_version("android-sdk-cmake", {
|
||||||
|
"source": "android_sdk",
|
||||||
|
"android_sdk": "cmake;",
|
||||||
|
"repo": "package",
|
||||||
|
"channel": "beta,dev,canary",
|
||||||
}) == "3.18.1"
|
}) == "3.18.1"
|
||||||
|
|
Loading…
Add table
Reference in a new issue