Skip to content

Commit

Permalink
Added a --check-version option
Browse files Browse the repository at this point in the history
  • Loading branch information
eminence committed May 3, 2014
1 parent 7c23d6e commit 9487d6f
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions overviewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ def main():
help="Tries to locate the texture files. Useful for debugging texture problems.")
parser.add_option("-V", "--version", dest="version",
help="Displays version information and then exits", action="store_true")
parser.add_option("--check-version", dest="checkversion",
help="Fetchs information about the latest version of Overviewer", action="store_true")
parser.add_option("--update-web-assets", dest='update_web_assets', action="store_true",
help="Update web assets. Will *not* render tiles or update overviewerConfig.js")

Expand Down Expand Up @@ -141,8 +143,28 @@ def main():
if options.verbose > 0:
print("Python executable: %r" % sys.executable)
print(sys.version)
if not options.checkversion:
return 0
if options.checkversion:
print("Currently running Minecraft Overviewer %s" % util.findGitVersion()),
print("(%s)" % util.findGitHash()[:7])
try:
import urllib
import json
latest_ver = json.loads(urllib.urlopen("http://overviewer.org/download.json").read())['src']
print("Latest version of Minecraft Overviewer %s (%s)" % (latest_ver['version'], latest_ver['commit'][:7]))
print("See http://overviewer.org/downloads for more information")
except Exception:
print("Failed to fetch latest version info.")
if options.verbose > 0:
import traceback
traceback.print_exc()
else:
print("Re-run with --verbose for more details")
return 1
return 0


if options.pid:
if os.path.exists(options.pid):
try:
Expand Down

0 comments on commit 9487d6f

Please sign in to comment.