diff options
author | Till Maas <opensource@till.name> | 2014-02-14 18:40:43 +0100 |
---|---|---|
committer | Till Maas <opensource@till.name> | 2014-02-14 18:40:43 +0100 |
commit | f4295044c4ae0c7f3b58e2ff5a195fc21051c0f9 (patch) | |
tree | 40f25db2828133d422b0465977464b8f262338f3 | |
parent | db7aba42bf4c2d1dd1c3e34e5107c3cf3a9de42b (diff) | |
download | cnucnu-f4295044c4ae0c7f3b58e2ff5a195fc21051c0f9.tar.gz cnucnu-f4295044c4ae0c7f3b58e2ff5a195fc21051c0f9.tar.xz cnucnu-f4295044c4ae0c7f3b58e2ff5a195fc21051c0f9.zip |
Add GITHUB-TAGS alias
Proposed by Christopher Meng <cickumqt@gmail.com>
-rw-r--r-- | cnucnu/__init__.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/cnucnu/__init__.py b/cnucnu/__init__.py index 0c817cb..8c67f94 100644 --- a/cnucnu/__init__.py +++ b/cnucnu/__init__.py @@ -53,6 +53,10 @@ ALIASES = { "regex": '<a href="/projects/[^/]*/releases/[0-9]*">([^<]*)</a>', "url": "http://freshmeat.net/projects/{name}", }, + "GITHUB-TAGS": { + "url": "https://api.github.com/repos/{name}/tags", + "regex": '"name":\s*"([\d\.]+)"', + }, "GNU-DEFAULT": { "url": "http://ftp.gnu.org/gnu/{name}/" }, @@ -140,8 +144,10 @@ def unalias(name, value, what): format_values = {"name": re.escape(name), "raw_name": re.escape(raw_name)} elif what == "url": - format_values = {"name": urllib.quote(name, safe=""), - "raw_name": urllib.quote(raw_name, safe="")} + # Slashes need to be allowed for GITHUB alias and should not cause + # be used/cause trouble for other packages + format_values = {"name": urllib.quote(name, safe="/"), + "raw_name": urllib.quote(raw_name, safe="/")} else: raise NotImplementedError("what needs ot be 'regex' or 'url'") |