File: hackage.py

package info (click to toggle)
nvchecker 2.19-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 804 kB
  • sloc: python: 5,192; makefile: 30; sh: 27
file content (15 lines) | stat: -rw-r--r-- 479 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# MIT licensed
# Copyright (c) 2013-2020 lilydjwg <lilydjwg@gmail.com>, et al.

from nvchecker.api import RichResult

HACKAGE_URL = 'https://hackage.haskell.org/package/%s/preferred.json'

async def get_version(name, conf, *, cache, **kwargs):
  key = conf.get('hackage', name)
  data = await cache.get_json(HACKAGE_URL % key)
  version = data['normal-version'][0]
  return RichResult(
    version = version,
    url = f'https://hackage.haskell.org/package/{key}-{version}',
  )