mirror of
https://github.com/lilydjwg/nvchecker
synced 2024-12-24 15:42:46 +00:00
android-sdk improvements
* Returns all matched versions to support list options * Don't hard-code the host OS * Document the default of `channel`
This commit is contained in:
parent
c6ed37ada1
commit
c15e9b7576
@ -731,7 +731,12 @@ repo
|
||||
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``.
|
||||
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``. The default is ``stable``.
|
||||
|
||||
host_os
|
||||
Choose the target OS for the tracked package from one of ``linux``, ``macosx``, ``windows``. The default is ``linux``. For OS-independent packages (e.g., Java JARs), this field is ignored.
|
||||
|
||||
This source supports :ref:`list options`.
|
||||
|
||||
Check Sparkle framework
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
@ -38,6 +38,8 @@ async def get_version(name, conf, *, cache, **kwargs):
|
||||
|
||||
repo_manifest = await cache.get(repo, _get_repo_manifest)
|
||||
|
||||
versions = []
|
||||
|
||||
for pkg in repo_manifest.findall('.//remotePackage'):
|
||||
if not pkg.attrib['path'].startswith(pkg_path_prefix):
|
||||
continue
|
||||
@ -46,7 +48,7 @@ async def get_version(name, conf, *, cache, **kwargs):
|
||||
continue
|
||||
for archive in pkg.findall('./archives/archive'):
|
||||
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 != conf.get('host_os', 'linux'):
|
||||
continue
|
||||
archive_url = archive.find('./complete/url').text
|
||||
# revision
|
||||
@ -62,4 +64,8 @@ async def get_version(name, conf, *, cache, **kwargs):
|
||||
mobj = re.match(r'r\d+', rel_str)
|
||||
if mobj:
|
||||
rev_strs.append(rel_str)
|
||||
return '.'.join(rev_strs)
|
||||
versions.append('.'.join(rev_strs))
|
||||
# A package suitable for the target host OS is found - skip remaining
|
||||
break
|
||||
|
||||
return versions
|
||||
|
@ -27,3 +27,27 @@ async def test_android_package_channel(get_version):
|
||||
"repo": "package",
|
||||
"channel": "beta,dev,canary",
|
||||
}) == "3.22.1"
|
||||
|
||||
async def test_android_list(get_version):
|
||||
assert await get_version("android-sdk-cmake-older", {
|
||||
"source": "android_sdk",
|
||||
"android_sdk": "cmake;",
|
||||
"repo": "package",
|
||||
"include_regex": "3\.10.*",
|
||||
}) == "3.10.2"
|
||||
|
||||
async def test_android_package_os(get_version):
|
||||
await get_version("android-usb-driver", {
|
||||
"source": "android_sdk",
|
||||
"android_sdk": "extras;google;usb_driver",
|
||||
"repo": "addon",
|
||||
"host_os": "windows"
|
||||
}) == "13"
|
||||
|
||||
async def test_android_package_os_missing(get_version):
|
||||
await get_version("android-usb-driver", {
|
||||
"source": "android_sdk",
|
||||
"android_sdk": "extras;google;usb_driver",
|
||||
"repo": "addon",
|
||||
"host_os": "linux"
|
||||
}) == None
|
||||
|
Loading…
Reference in New Issue
Block a user