mirror of
https://github.com/lilydjwg/nvchecker
synced 2024-12-27 17:12:25 +00:00
Merge remote-tracking branch 'origin/pr/18'
This commit is contained in:
commit
03e77aa1af
@ -173,6 +173,13 @@ Check `Hackage <https://hackage.haskell.org/>`_ for updates.
|
||||
hackage
|
||||
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
|
||||
---------------------------
|
||||
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 = (
|
||||
'github', 'gitcafe', 'aur', 'pypi', 'archpkg', 'gems', 'pacman',
|
||||
'cmd', 'bitbucket', 'gcode_hg', 'gcode_svn', 'regex', 'manual', 'vcs',
|
||||
'npm', 'hackage',
|
||||
'npm', 'hackage', 'cpan',
|
||||
)
|
||||
|
||||
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…
Reference in New Issue
Block a user