From a147f22fc45f037b308a707c1290f7473802f4f1 Mon Sep 17 00:00:00 2001 From: lilydjwg Date: Sun, 3 Nov 2013 00:21:46 +0800 Subject: [PATCH] support 'pacman' source; README update --- README.rst | 11 ++++++++++- nvchecker/get_version.py | 9 ++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 996e74c..a54c787 100644 --- a/README.rst +++ b/README.rst @@ -72,7 +72,7 @@ regex When multiple version strings are found, the maximum of those is chosen. proxy - The HTTP proxy to use. The format is ``host:port``, e.g. ``localhost:8087``. + The HTTP proxy to use. The format is ``host:port``, e.g. ``localhost:8087``. This requires `pycurl _`. Find with a Command ------------------- @@ -102,6 +102,13 @@ Check `PyPI `_ for updates. pypi The name used on PyPI, e.g. ``PySide``. +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 `_. + +pacman + The package name to reference to. + Check Google Code (hg repository) --------------------------------- Check a mecurial (hg) repository on `Google Code `_ for updates. The version returned is in date format ``%Y%m%d``, e.g. ``20130701``. @@ -129,3 +136,5 @@ Bugs TODO ==== * Tool to replace the ``join`` command +* Support GitHub tags +* Remove troublesome colon from record files diff --git a/nvchecker/get_version.py b/nvchecker/get_version.py index ec7bb34..bfb065f 100644 --- a/nvchecker/get_version.py +++ b/nvchecker/get_version.py @@ -13,7 +13,8 @@ import tornado.process from tornado.ioloop import IOLoop logger = logging.getLogger(__name__) -handler_precedence = ('github', 'aur', 'pypi', 'cmd', 'gcode_hg', 'regex') +handler_precedence = ('github', 'aur', 'pypi', 'pacman', + 'cmd', 'gcode_hg', 'regex') try: import pycurl @@ -158,3 +159,9 @@ def _gcodehg_done(name, callback, res): version = None callback(name, version) + +def get_version_by_pacman(name, conf, callback): + referree = conf['pacman'] + cmd = "LANG=C pacman -Si %s | grep -F Version | awk '{print $3}'" % referree + conf['cmd'] = cmd + get_version_by_cmd(name, conf, callback)