Also use pre-calculated revision information instead of fetching anew

This commit is contained in:
Gina Häußge 2015-12-14 10:16:29 +01:00
parent e8bd29ef99
commit 7fcd04ae61
2 changed files with 4 additions and 5 deletions

View file

@ -18,7 +18,7 @@ from . import version_checks, updaters, exceptions, util
from octoprint.server.util.flask import restricted_access
from octoprint.server import admin_permission, VERSION
from octoprint.server import admin_permission, VERSION, REVISION
from octoprint.util import dict_merge
import octoprint.settings
@ -688,9 +688,7 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin,
result["displayVersion"] = check.get("displayVersion", "{octoprint_version}")
if check["type"] == "github_commit":
from octoprint._version import get_versions
versions = get_versions()
result["current"] = versions.get("full-revisionid", versions.get("full", "unknown"))
result["current"] = REVISION if REVISION else "unknown"
else:
result["current"] = VERSION
else:

View file

@ -72,8 +72,9 @@ UI_API_KEY = ''.join('%02X' % ord(z) for z in uuid.uuid4().bytes)
versions = octoprint._version.get_versions()
VERSION = versions['version']
BRANCH = versions['branch'] if 'branch' in versions else None
BRANCH = versions.get('branch', None)
DISPLAY_VERSION = "%s (%s branch)" % (VERSION, BRANCH) if BRANCH else VERSION
REVISION = versions.get('full-revision-id', versions.get('full', None))
del versions
LOCALES = []