mirror of
https://github.com/lilydjwg/nvchecker.git
synced 2025-03-10 06:14:02 +00:00
Merge remote-tracking branch 'origin/pr/17'
This commit is contained in:
commit
0cd587c6ba
3 changed files with 25 additions and 1 deletions
|
@ -166,6 +166,13 @@ Check `NPM Registry <https://registry.npmjs.org/>`_ for updates.
|
|||
npm
|
||||
The name used on NPM Registry, e.g. ``coffee-script``.
|
||||
|
||||
Check Hackage
|
||||
----------
|
||||
Check `Hackage <https://hackage.haskell.org/>`_ for updates.
|
||||
|
||||
hackage
|
||||
The name used on Hackage, e.g. ``pandoc``.
|
||||
|
||||
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',
|
||||
'npm', 'hackage',
|
||||
)
|
||||
|
||||
def get_version(name, conf, callback):
|
||||
|
|
17
nvchecker/source/hackage.py
Normal file
17
nvchecker/source/hackage.py
Normal file
|
@ -0,0 +1,17 @@
|
|||
import json
|
||||
from functools import partial
|
||||
|
||||
from tornado.httpclient import AsyncHTTPClient
|
||||
|
||||
HACKAGE_URL = 'https://hackage.haskell.org/package/%s/preferred.json'
|
||||
|
||||
def get_version(name, conf, callback):
|
||||
repo = conf.get('hackage') or name
|
||||
url = HACKAGE_URL % repo
|
||||
AsyncHTTPClient().fetch(url, user_agent='lilydjwg/nvchecker',
|
||||
callback=partial(_hackage_done, name, callback))
|
||||
|
||||
def _hackage_done(name, callback, res):
|
||||
data = json.loads(res.body.decode('utf-8'))
|
||||
version = data['normal-version'][0]
|
||||
callback(name, version)
|
Loading…
Add table
Reference in a new issue