From aa418aba20d0c45609f122908f8ace3452a5d8a0 Mon Sep 17 00:00:00 2001 From: lilydjwg Date: Thu, 1 Sep 2016 20:40:51 +0800 Subject: [PATCH] remove support for GitCafe, which has died closes #42 --- README.rst | 13 ------------- nvchecker/get_version.py | 2 +- nvchecker/source/gitcafe.py | 23 ----------------------- tests/test_gitcafe.py.too_slow_to_succeed | 8 -------- 4 files changed, 1 insertion(+), 45 deletions(-) delete mode 100644 nvchecker/source/gitcafe.py delete mode 100644 tests/test_gitcafe.py.too_slow_to_succeed diff --git a/README.rst b/README.rst index 48cf81f..ed19f16 100644 --- a/README.rst +++ b/README.rst @@ -24,7 +24,6 @@ Contents * `Check AUR <#check-aur>`_ * `Check GitHub <#check-github>`_ * `Check BitBucket <#check-bitbucket>`_ - * `Check GitCafe <#check-gitcafe>`_ * `Check GitLab <#check-gitlab>`_ * `Check PyPI <#check-pypi>`_ * `Check RubyGems <#check-rubygems>`_ @@ -223,18 +222,6 @@ sort_version_key ``vercmp``. Default value is ``parse_version``. ``parse_version`` use ``pkg_resources.parse_version``. ``vercmp`` use ``pyalpm.vercmp``. -Check GitCafe -------------- -Check `GitCafe `_ for updates. The version returned is in date format ``%Y%m%d``, e.g. ``20130701``. - -gitcafe - The gitcafe repository, with author, e.g. ``Deepin/deepin-music``. - -branch - Which branch to track? Default: ``master``. - -Anonymously only. Authorization is not supported yet. - Check GitLab ------------- Check `GitLab `_ for updates. The version returned is in date format ``%Y%m%d``, e.g. ``20130701``. diff --git a/nvchecker/get_version.py b/nvchecker/get_version.py index 95568db..77cec17 100644 --- a/nvchecker/get_version.py +++ b/nvchecker/get_version.py @@ -3,7 +3,7 @@ from importlib import import_module logger = logging.getLogger(__name__) handler_precedence = ( - 'github', 'gitcafe', 'aur', 'pypi', 'archpkg', 'gems', 'pacman', + 'github', 'aur', 'pypi', 'archpkg', 'gems', 'pacman', 'cmd', 'bitbucket', 'gcode_hg', 'gcode_svn', 'regex', 'manual', 'vcs', 'cratesio', 'npm', 'hackage', 'cpan', 'gitlab', 'packagist' ) diff --git a/nvchecker/source/gitcafe.py b/nvchecker/source/gitcafe.py deleted file mode 100644 index f2e1c57..0000000 --- a/nvchecker/source/gitcafe.py +++ /dev/null @@ -1,23 +0,0 @@ -import os -import json -import re -from functools import partial - -from tornado.httpclient import AsyncHTTPClient, HTTPRequest - -GITCAFE_URL = 'https://gitcafe.com/%s/commits/%s' -gitcafe_pattern = re.compile(r'datetime="([^"]*)"') - -def get_version(name, conf, callback): - repo = conf.get('gitcafe') - br = conf.get('branch', 'master') - url = GITCAFE_URL % (repo, br) - headers = {'Accept': "text/html"} - request = HTTPRequest(url, headers=headers, user_agent='lilydjwg/nvchecker') - AsyncHTTPClient().fetch(request, callback=partial(_gitcafe, name, callback)) - -def _gitcafe(name, callback, res): - body = res.body.decode('utf-8') - data = gitcafe_pattern.search(body).group(1) - version = data.split('T', 1)[0].replace('-', '') - callback(name, version) diff --git a/tests/test_gitcafe.py.too_slow_to_succeed b/tests/test_gitcafe.py.too_slow_to_succeed deleted file mode 100644 index babdf6c..0000000 --- a/tests/test_gitcafe.py.too_slow_to_succeed +++ /dev/null @@ -1,8 +0,0 @@ -from flaky import flaky -from tests.helper import ExternalVersionTestCase - - -class GitCafeTest(ExternalVersionTestCase): - @flaky(max_runs=7) - def test_gitcafe(self): - self.assertEqual(self.sync_get_version("example", {"gitcafe": "test/test"}), "20120201")