Replace get_versions() calls with octoprint.server.VERSION, to get some time improvment
This commit is contained in:
parent
8a7d234571
commit
e8bd29ef99
2 changed files with 8 additions and 11 deletions
|
|
@ -11,7 +11,7 @@ import octoprint.plugin.core
|
|||
|
||||
from octoprint.settings import valid_boolean_trues
|
||||
from octoprint.server.util.flask import restricted_access
|
||||
from octoprint.server import admin_permission
|
||||
from octoprint.server import admin_permission, VERSION
|
||||
from octoprint.util.pip import PipCaller, UnknownPip
|
||||
|
||||
from flask import jsonify, make_response
|
||||
|
|
@ -184,7 +184,7 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
|
|||
plugins=self._repository_plugins
|
||||
),
|
||||
os=self._get_os(),
|
||||
octoprint=self._get_octoprint_version(),
|
||||
octoprint=VERSION,
|
||||
pip=dict(
|
||||
available=self._pip_caller.available,
|
||||
command=self._pip_caller.command,
|
||||
|
|
@ -612,8 +612,7 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
|
|||
return "unknown"
|
||||
|
||||
def _get_octoprint_version(self):
|
||||
from octoprint._version import get_versions
|
||||
return get_versions()["version"]
|
||||
return VERSION
|
||||
|
||||
def _to_external_representation(self, plugin):
|
||||
return dict(
|
||||
|
|
|
|||
|
|
@ -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
|
||||
from octoprint.server import admin_permission, VERSION
|
||||
from octoprint.util import dict_merge
|
||||
import octoprint.settings
|
||||
|
||||
|
|
@ -430,8 +430,6 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin,
|
|||
update_available = update_available or target_update_available
|
||||
update_possible = update_possible or (target_update_possible and target_update_available)
|
||||
|
||||
from octoprint._version import get_versions
|
||||
octoprint_version = get_versions()["version"]
|
||||
local_name = target_information["local"]["name"]
|
||||
local_value = target_information["local"]["value"]
|
||||
|
||||
|
|
@ -439,7 +437,7 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin,
|
|||
updatePossible=target_update_possible,
|
||||
information=target_information,
|
||||
displayName=populated_check["displayName"],
|
||||
displayVersion=populated_check["displayVersion"].format(octoprint_version=octoprint_version, local_name=local_name, local_value=local_value),
|
||||
displayVersion=populated_check["displayVersion"].format(octoprint_version=VERSION, local_name=local_name, local_value=local_value),
|
||||
check=populated_check)
|
||||
|
||||
if self._version_cache_dirty:
|
||||
|
|
@ -689,12 +687,12 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin,
|
|||
result["displayName"] = check.get("displayName", gettext("OctoPrint"))
|
||||
result["displayVersion"] = check.get("displayVersion", "{octoprint_version}")
|
||||
|
||||
from octoprint._version import get_versions
|
||||
versions = get_versions()
|
||||
if check["type"] == "github_commit":
|
||||
from octoprint._version import get_versions
|
||||
versions = get_versions()
|
||||
result["current"] = versions.get("full-revisionid", versions.get("full", "unknown"))
|
||||
else:
|
||||
result["current"] = versions["version"]
|
||||
result["current"] = VERSION
|
||||
else:
|
||||
result["displayName"] = check.get("displayName", target)
|
||||
result["displayVersion"] = check.get("displayVersion", check.get("current", "unknown"))
|
||||
|
|
|
|||
Loading…
Reference in a new issue