mirror of
https://github.com/lilydjwg/nvchecker.git
synced 2025-03-10 06:14:02 +00:00
Merge pull request #126 from guizai/add-sparkle-source
Add sparkle source
This commit is contained in:
commit
4109091955
5 changed files with 51 additions and 1 deletions
|
@ -49,6 +49,7 @@ Contents
|
||||||
* `Check Repology (repology.org) <#check-repology>`_
|
* `Check Repology (repology.org) <#check-repology>`_
|
||||||
* `Check Anitya (release-monitoring.org) <#check-anitya>`_
|
* `Check Anitya (release-monitoring.org) <#check-anitya>`_
|
||||||
* `Check Android SDK <#check-android-sdk>`_
|
* `Check Android SDK <#check-android-sdk>`_
|
||||||
|
* `Check Sparkle framework <#check-sparkle-framework>`_
|
||||||
* `Manually updating <#manually-updating>`_
|
* `Manually updating <#manually-updating>`_
|
||||||
* `Version Control System (VCS) (git, hg, svn, bzr) <#version-control-system-vcs-git-hg-svn-bzr>`_
|
* `Version Control System (VCS) (git, hg, svn, bzr) <#version-control-system-vcs-git-hg-svn-bzr>`_
|
||||||
* `Other <#other>`_
|
* `Other <#other>`_
|
||||||
|
@ -506,6 +507,13 @@ 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``.
|
||||||
|
|
||||||
|
Check Sparkle framework
|
||||||
|
-----------------------
|
||||||
|
This enables you to track updates of macOS applications which using `Sparkle framework <https://sparkle-project.org/>`_.
|
||||||
|
|
||||||
|
sparkle
|
||||||
|
The url of the sparkle appcast.
|
||||||
|
|
||||||
Manually updating
|
Manually updating
|
||||||
-----------------
|
-----------------
|
||||||
This enables you to manually specify the version (maybe because you want to approve each release before it gets to the script).
|
This enables you to manually specify the version (maybe because you want to approve each release before it gets to the script).
|
||||||
|
|
|
@ -15,7 +15,7 @@ handler_precedence = (
|
||||||
'gems', 'pacman',
|
'gems', 'pacman',
|
||||||
'cmd', 'bitbucket', 'regex', 'manual', 'vcs',
|
'cmd', 'bitbucket', 'regex', 'manual', 'vcs',
|
||||||
'cratesio', 'npm', 'hackage', 'cpan', 'gitlab', 'packagist',
|
'cratesio', 'npm', 'hackage', 'cpan', 'gitlab', 'packagist',
|
||||||
'repology', 'anitya', 'android_sdk',
|
'repology', 'anitya', 'android_sdk', 'sparkle',
|
||||||
)
|
)
|
||||||
|
|
||||||
def substitute_version(version, name, conf):
|
def substitute_version(version, name, conf):
|
||||||
|
|
31
nvchecker/source/sparkle.py
Normal file
31
nvchecker/source/sparkle.py
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
# MIT licensed
|
||||||
|
# Copyright (c) 2020 Sunlei <guizaicn@gmail.com>
|
||||||
|
|
||||||
|
from xml.etree import ElementTree
|
||||||
|
|
||||||
|
from . import session
|
||||||
|
|
||||||
|
|
||||||
|
async def get_version(name, conf, **kwargs):
|
||||||
|
sparkle = conf['sparkle']
|
||||||
|
|
||||||
|
async with session.get(sparkle) as res:
|
||||||
|
resp = await res.read()
|
||||||
|
|
||||||
|
root = ElementTree.fromstring(resp)
|
||||||
|
item = root.find('./channel/item[1]/enclosure')
|
||||||
|
|
||||||
|
version_string = item.get('{http://www.andymatuschak.org/xml-namespaces/sparkle}shortVersionString')
|
||||||
|
build_number = item.get('{http://www.andymatuschak.org/xml-namespaces/sparkle}version')
|
||||||
|
|
||||||
|
if (version_string and version_string.isdigit()) and (build_number and not build_number.isdigit()):
|
||||||
|
version_string, build_number = build_number, version_string
|
||||||
|
|
||||||
|
version = []
|
||||||
|
|
||||||
|
if version_string:
|
||||||
|
version.append(version_string)
|
||||||
|
if build_number:
|
||||||
|
version.append(build_number)
|
||||||
|
|
||||||
|
return '-'.join(version) if version else None
|
|
@ -32,3 +32,6 @@ pypi = PySide
|
||||||
|
|
||||||
[test]
|
[test]
|
||||||
manual = 0.1
|
manual = 0.1
|
||||||
|
|
||||||
|
[Sparkle Test App]
|
||||||
|
sparkle = https://sparkle-project.org/files/sparkletestcast.xml
|
||||||
|
|
8
tests/test_sparkle.py
Normal file
8
tests/test_sparkle.py
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# MIT licensed
|
||||||
|
# Copyright (c) 2020 Sunlei <guizaicn@gmail.com>
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net]
|
||||||
|
|
||||||
|
async def test_sparkle(get_version):
|
||||||
|
assert await get_version("example", {"sparkle": "https://sparkle-project.org/files/sparkletestcast.xml"}) == "2.0"
|
Loading…
Add table
Reference in a new issue