mirror of
https://github.com/lilydjwg/nvchecker.git
synced 2025-03-10 06:14:02 +00:00
add Anitya support
This commit is contained in:
parent
c3503c34ac
commit
2d2f7149aa
3 changed files with 28 additions and 1 deletions
|
@ -9,7 +9,8 @@ handler_precedence = (
|
||||||
'github', 'aur', 'pypi', 'archpkg', 'debianpkg', 'ubuntupkg',
|
'github', 'aur', 'pypi', 'archpkg', 'debianpkg', 'ubuntupkg',
|
||||||
'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',
|
||||||
|
'anitya',
|
||||||
)
|
)
|
||||||
|
|
||||||
async def get_version(name, conf):
|
async def get_version(name, conf):
|
||||||
|
|
18
nvchecker/source/anitya.py
Normal file
18
nvchecker/source/anitya.py
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
# MIT licensed
|
||||||
|
# Copyright (c) 2017 lilydjwg <lilydjwg@gmail.com>, et al.
|
||||||
|
|
||||||
|
import logging
|
||||||
|
from . import session
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
URL = 'https://release-monitoring.org/api/project/{pkg}'
|
||||||
|
|
||||||
|
async def get_version(name, conf):
|
||||||
|
pkg = conf.get('anitya')
|
||||||
|
url = URL.format(pkg = pkg)
|
||||||
|
|
||||||
|
async with session.get(url) as res:
|
||||||
|
data = await res.json()
|
||||||
|
|
||||||
|
return data['version']
|
8
tests/test_anitya.py
Normal file
8
tests/test_anitya.py
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# MIT licensed
|
||||||
|
# Copyright (c) 2017 Felix Yan <felixonmars@archlinux.org>, et al.
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
pytestmark = pytest.mark.asyncio
|
||||||
|
|
||||||
|
async def test_anitya(get_version):
|
||||||
|
assert await get_version("shutter", {"anitya": "fedora/shutter"}) == "0.93.1"
|
Loading…
Add table
Reference in a new issue