mirror of
https://github.com/lilydjwg/nvchecker.git
synced 2025-03-10 06:14:02 +00:00
Merge remote-tracking branch 'origin/pr/18'
This commit is contained in:
commit
03e77aa1af
3 changed files with 26 additions and 1 deletions
|
@ -173,6 +173,13 @@ Check `Hackage <https://hackage.haskell.org/>`_ for updates.
|
||||||
hackage
|
hackage
|
||||||
The name used on Hackage, e.g. ``pandoc``.
|
The name used on Hackage, e.g. ``pandoc``.
|
||||||
|
|
||||||
|
Check CPAN
|
||||||
|
--------------
|
||||||
|
Check `MetaCPAN <https://metacpan.org/>`_ for updates.
|
||||||
|
|
||||||
|
cpan
|
||||||
|
The name used on CPAN, e.g. ``YAML``.
|
||||||
|
|
||||||
Check Local Pacman Database
|
Check Local Pacman Database
|
||||||
---------------------------
|
---------------------------
|
||||||
This is used when you run ``nvchecker`` on an Arch Linux system and the program always keeps up with a package in your configured repositories for `Pacman`_.
|
This is used when you run ``nvchecker`` on an Arch Linux system and the program always keeps up with a package in your configured repositories for `Pacman`_.
|
||||||
|
|
|
@ -5,7 +5,7 @@ logger = logging.getLogger(__name__)
|
||||||
handler_precedence = (
|
handler_precedence = (
|
||||||
'github', 'gitcafe', 'aur', 'pypi', 'archpkg', 'gems', 'pacman',
|
'github', 'gitcafe', 'aur', 'pypi', 'archpkg', 'gems', 'pacman',
|
||||||
'cmd', 'bitbucket', 'gcode_hg', 'gcode_svn', 'regex', 'manual', 'vcs',
|
'cmd', 'bitbucket', 'gcode_hg', 'gcode_svn', 'regex', 'manual', 'vcs',
|
||||||
'npm', 'hackage',
|
'npm', 'hackage', 'cpan',
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_version(name, conf, callback):
|
def get_version(name, conf, callback):
|
||||||
|
|
18
nvchecker/source/cpan.py
Normal file
18
nvchecker/source/cpan.py
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
import json
|
||||||
|
from functools import partial
|
||||||
|
|
||||||
|
from tornado.httpclient import AsyncHTTPClient
|
||||||
|
|
||||||
|
# Using metacpan
|
||||||
|
CPAN_URL = 'https://api.metacpan.org/release/%s'
|
||||||
|
|
||||||
|
def get_version(name, conf, callback):
|
||||||
|
repo = conf.get('cpan') or name
|
||||||
|
url = CPAN_URL % repo
|
||||||
|
AsyncHTTPClient().fetch(url, user_agent='lilydjwg/nvchecker',
|
||||||
|
callback=partial(_cpan_done, name, callback))
|
||||||
|
|
||||||
|
def _cpan_done(name, callback, res):
|
||||||
|
data = json.loads(res.body.decode('utf-8'))
|
||||||
|
version = data['version']
|
||||||
|
callback(name, version)
|
Loading…
Add table
Reference in a new issue