Merge branch 'maintenance' into devel

This commit is contained in:
Gina Häußge committed 2021-07-02 16:32:44 +02:00
commit 635156cf7a
64 files changed
+1185 -441

No files matched your search

@@ -100,6 +100,7 @@ def map_repository_entry(entry):
already_installed_string = "Requirement already satisfied (use --upgrade to upgrade)"
success_string = "Successfully installed"
failure_string = "Could not install"
python_mismatch_string = "requires a different Python:"
class PluginManagerPlugin(
@@ -940,6 +941,22 @@ class PluginManagerPlugin(
self._send_result_notification("install", result)
return result
if any(map(lambda x: python_mismatch_string in x, stderr)):
self._logger.error(
"Installing the plugin from {} failed, pip reported a Python version mismatch".format(
source
)
)
result = {
"result": False,
"source": source,
"source_type": source_type,
"reason": "Pip reported a Python version mismatch",
"faq": "https://faq.octoprint.org/plugin-python-mismatch",
}
self._send_result_notification("install", result)
return result
try:
result_line = list(
filter(
@@ -1094,6 +1111,42 @@ class PluginManagerPlugin(
destination = os.path.join(self._settings.global_get_basefolder("plugins"), name)
plugin_id, _ = os.path.splitext(name)
# check python compatibility
PYTHON_MISMATCH = {
"result": False,
"source": source,
"source_type": source_type,
"reason": "Plugin could not be installed",
"faq": "https://faq.octoprint.org/plugin-python-mismatch",
}
try:
metadata = octoprint.plugin.core.parse_plugin_metadata(path)
except SyntaxError:
self._logger.exception(
"Installing plugin from {} failed, there's a Python version mismatch".format(
source
)
)
result = PYTHON_MISMATCH
self._send_result_notification("install", result)
return result
pythoncompat = metadata.get(
octoprint.plugin.core.ControlProperties.attr_pythoncompat,
octoprint.plugin.core.ControlProperties.default_pythoncompat,
)
if not is_python_compatible(pythoncompat):
self._logger.exception(
"Installing plugin from {} failed, there's a Python version mismatch".format(
source
)
)
result = PYTHON_MISMATCH
self._send_result_notification("install", result)
return result
# copy plugin
try:
self._log_call(f"cp {path} {destination}")
shutil.copy(path, destination)