Skip to content
Permalink
Browse files
Fix #3170 — make nikola version --check work again
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Sep 30, 2018
1 parent f58ba9a commit 1a449018a9b7a08f579cb15fbad2da542ca27269
Showing with 8 additions and 6 deletions.
  1. +1 −0 CHANGES.txt
  2. +7 −6 nikola/plugins/command/version.py
@@ -10,6 +10,7 @@ Features
Bugfixes
--------

* Make ``nikola version --check`` work again (Issue #3170)
* Set logging level for reST to warning in order to limit noise
* Fix docinfo removal for sites that use reST docinfo metadata
(Issue #3167)
@@ -33,7 +33,7 @@
from nikola.plugin_categories import Command
from nikola import __version__

URL = 'https://pypi.python.org/pypi?:action=doap&name=Nikola'
URL = 'https://pypi.org/pypi/Nikola/json'


class CommandVersion(Command):
@@ -59,10 +59,11 @@ def _execute(self, options={}, args=None):
"""Print the version number."""
print("Nikola v" + __version__)
if options.get('check'):
data = requests.get(URL).text
doc = lxml.etree.fromstring(data.encode('utf8'))
revision = doc.findall('*//{http://usefulinc.com/ns/doap#}revision')[0].text
if revision == __version__:
data = requests.get(URL).json()
pypi_version = data['info']['version']
if pypi_version == __version__:
print("Nikola is up-to-date")
else:
print("The latest version of Nikola is v{0} -- please upgrade using `pip install --upgrade Nikola=={0}` or your system package manager".format(revision))
print("The latest version of Nikola is v{0}. Please upgrade "
"using `pip install --upgrade Nikola=={0}` or your "
"system package manager.".format(pypi_version))

0 comments on commit 1a44901

Please sign in to comment.