mirror of
https://github.com/lilydjwg/nvchecker.git
synced 2025-03-10 06:14:02 +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
3 changed files with 38 additions and 3 deletions
|
@ -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``.
|
Should be one of ``addon`` or ``package``. Packages in ``addon2-1.xml`` use ``addon`` and packages in ``repository2-1.xml`` use ``package``.
|
||||||
|
|
||||||
channel
|
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
|
Check Sparkle framework
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
|
@ -38,6 +38,8 @@ async def get_version(name, conf, *, cache, **kwargs):
|
||||||
|
|
||||||
repo_manifest = await cache.get(repo, _get_repo_manifest)
|
repo_manifest = await cache.get(repo, _get_repo_manifest)
|
||||||
|
|
||||||
|
versions = []
|
||||||
|
|
||||||
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
|
||||||
|
@ -46,7 +48,7 @@ async def get_version(name, conf, *, cache, **kwargs):
|
||||||
continue
|
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 != conf.get('host_os', 'linux'):
|
||||||
continue
|
continue
|
||||||
archive_url = archive.find('./complete/url').text
|
archive_url = archive.find('./complete/url').text
|
||||||
# revision
|
# revision
|
||||||
|
@ -62,4 +64,8 @@ async def get_version(name, conf, *, cache, **kwargs):
|
||||||
mobj = re.match(r'r\d+', rel_str)
|
mobj = re.match(r'r\d+', rel_str)
|
||||||
if mobj:
|
if mobj:
|
||||||
rev_strs.append(rel_str)
|
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",
|
"repo": "package",
|
||||||
"channel": "beta,dev,canary",
|
"channel": "beta,dev,canary",
|
||||||
}) == "3.22.1"
|
}) == "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…
Add table
Reference in a new issue