+ This version of the Python environment is not supported for direct updates.
+
+
+ To reduce the likelihood of running into update problems in outdated environments, the following minimal
+ versions are required to use this updater to update OctoPrint or any installed plugins:
+
diff --git a/src/octoprint/plugins/softwareupdate/updaters/pip.py b/src/octoprint/plugins/softwareupdate/updaters/pip.py
index 08dfed097..fb970144f 100644
--- a/src/octoprint/plugins/softwareupdate/updaters/pip.py
+++ b/src/octoprint/plugins/softwareupdate/updaters/pip.py
@@ -10,6 +10,7 @@ import logging
import pkg_resources
from octoprint.util.pip import PipCaller, UnknownPip
+from octoprint.util.version import get_comparable_version
from .. import exceptions
logger = logging.getLogger("octoprint.plugins.softwareupdate.updaters.pip")
@@ -23,8 +24,13 @@ _pip_callers = dict()
_pip_version_dependency_links = pkg_resources.parse_version("1.5")
def can_perform_update(target, check, online=True):
+ from .. import MINIMUM_PIP
pip_caller = _get_pip_caller(command=check["pip_command"] if "pip_command" in check else None)
- return "pip" in check and pip_caller is not None and pip_caller.available and (online or check.get("offline", False))
+ return "pip" in check \
+ and pip_caller is not None \
+ and pip_caller.available \
+ and pip_caller.version >= get_comparable_version(MINIMUM_PIP) \
+ and (online or check.get("offline", False))
def _get_pip_caller(command=None):
key = command
diff --git a/src/octoprint/server/util/flask.py b/src/octoprint/server/util/flask.py
index 2ab536e36..792a6d8e1 100644
--- a/src/octoprint/server/util/flask.py
+++ b/src/octoprint/server/util/flask.py
@@ -1120,28 +1120,34 @@ def redirect_to_tornado(request, target, code=302):
def restricted_access(func):
+ """
+ This combines :py:func:`no_firstrun_access` and ``login_required``.
+ """
+ @functools.wraps(func)
+ def decorated_view(*args, **kwargs):
+ return no_firstrun_access(flask_login.login_required(func))(*args, **kwargs)
+ return decorated_view
+
+def no_firstrun_access(func):
"""
If you decorate a view with this, it will ensure that first setup has been
- done for OctoPrint's Access Control plus that any conditions of the
- login_required decorator are met (possibly through a session already created
- by octoprint.server.util.apiKeyRequestHandler earlier in the request processing).
+ done for OctoPrint's Access Control.
If OctoPrint's Access Control has not been setup yet (indicated by the "firstRun"
flag from the settings being set to True and the userManager not indicating
that it's user database has been customized from default), the decorator
will cause a HTTP 403 status code to be returned by the decorated resource.
"""
+
@functools.wraps(func)
def decorated_view(*args, **kwargs):
# if OctoPrint hasn't been set up yet, abort
if settings().getBoolean(["server", "firstRun"]) and settings().getBoolean(["accessControl", "enabled"]) and (octoprint.server.userManager is None or not octoprint.server.userManager.hasBeenCustomized()):
return flask.make_response("OctoPrint isn't setup yet", 403)
-
- return flask_login.login_required(func)(*args, **kwargs)
+ return func(*args, **kwargs)
return decorated_view
-
def firstrun_only_access(func):
"""
If you decorate a view with this, it will ensure that first setup has _not_ been
From 909dd551d6246b60760c26bbb6aaf448e3a21ef0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?=
Date: Sat, 28 Jul 2018 23:30:43 +0200
Subject: [PATCH 2/3] Specify support python versions
---
setup.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/setup.py b/setup.py
index ba2412f48..9b3135e15 100644
--- a/setup.py
+++ b/setup.py
@@ -12,6 +12,9 @@ import octoprint_setuptools
#-----------------------------------------------------------------------------------------------------------------------
+# Supported python versions
+PYTHON_REQUIRES = ">=2.7.3,<3" # TODO change to >=2.7.9,<3 in 1.3.11
+
# Requirements for our application
INSTALL_REQUIRES = [
"flask>=0.10.1,<0.11",
@@ -154,6 +157,7 @@ def params():
long_description = read_file_contents(os.path.join(here, "README.md"))
long_description_content_type = "text/markdown"
+ python_requires = PYTHON_REQUIRES
install_requires = INSTALL_REQUIRES
extras_require = EXTRA_REQUIRES
dependency_links = DEPENDENCY_LINKS
From a137946e3a02d568bc125a49a1daf303cdc77782 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?=
Date: Sat, 28 Jul 2018 23:36:28 +0200
Subject: [PATCH 3/3] Remove setup_requires - it's incompatible to pip
---
setup.py | 4 ----
1 file changed, 4 deletions(-)
diff --git a/setup.py b/setup.py
index 9b3135e15..0c48481af 100644
--- a/setup.py
+++ b/setup.py
@@ -82,9 +82,6 @@ EXTRA_REQUIRES = dict(
]
)
-# Additional requirements for setup
-SETUP_REQUIRES = []
-
# Dependency links for any of the aforementioned dependencies
DEPENDENCY_LINKS = []
@@ -161,7 +158,6 @@ def params():
install_requires = INSTALL_REQUIRES
extras_require = EXTRA_REQUIRES
dependency_links = DEPENDENCY_LINKS
- setup_requires = SETUP_REQUIRES
classifiers = [
"Development Status :: 5 - Production/Stable",