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)
@@ -424,7 +424,7 @@ $(function () {
self.uploadButton.bind("click", function () {
self._markWorking(
gettext("Installing plugin..."),
gettext("Installing plugin from uploaded archive...")
gettext("Installing plugin from uploaded file...")
);
data.formData = {
dependency_links: self.followDependencyLinks()
@@ -1217,7 +1217,7 @@ $(function () {
if (response.result) {
self._markDone();
} else {
self._markDone(response.reason);
self._markDone(response.reason, response.faq);
}
self._displayPluginManagementNotification(response, action, plugin);
@@ -1233,7 +1233,8 @@ $(function () {
self.logContents.steps.push({
action: action,
plugin: plugin,
result: response.result
result: response.result,
faq: response.faq
});
var title = gettext("Plugin management log");
@@ -1252,6 +1253,7 @@ $(function () {
steps = steps.slice(steps.length - 5);
}
var negativeResult = false;
_.each(steps, function (step) {
var line = undefined;
@@ -1293,7 +1295,14 @@ $(function () {
? '<i class="fa fa-check"></i>'
: '<i class="fa fa-remove"></i>'
}) +
(step.result === false && step.faq
? ' (<a href="" target="_blank" rel="noopener noreferer">' +
gettext("Why?") +
"</a>)"
: "") +
"</li>";
negativeResult = negativeResult || step.result === false;
});
text += "</ul></p>";
@@ -1385,6 +1394,8 @@ $(function () {
type = "warning";
}
if (negativeResult) type = "error";
var options = {
title: title,
text: text,
@@ -1432,11 +1443,22 @@ $(function () {
self.workingDialog.modal({keyboard: false, backdrop: "static", show: true});
};
self._markDone = function (error) {
self._markDone = function (error, faq) {
self.working(false);
if (error) {
self.loglines.push({line: gettext("Error!"), stream: "error"});
self.loglines.push({line: error, stream: "error"});
if (faq) {
self.loglines.push({
line: _.sprintf(
gettext(
"You can find more info on this issue in the FAQ at %(url)s"
),
{url: faq}
),
stream: "error"
});
}
} else {
self.loglines.push({line: gettext("Done!"), stream: "message"});
}
@@ -23,7 +23,8 @@
{% macro pluginmanager_throttled() %}
<div class="alert" data-bind="visible: throttled">{% trans %}
The system OctoPrint is running on is currently throttled. Due to that it's not possible to install new
plugins in order to avoid possible issues caused by system instability.
plugins in order to avoid possible issues caused by system instability. Read more on
this in <a href="https://faq.octoprint.org/pi-issues" target="_blank" rel="noopener noreferrer">the FAQ</a>.
{% endtrans %}</div>
{% endmacro %}
@@ -37,7 +38,7 @@
{% macro pluginmanager_requesterror() %}
<div class="alert" data-bind="visible: requestError()">{% trans %}
There appears to have been an error retrieving the plugin data from the backend. Please report this
in the bug tracker & be sure to include all requested logs.
in the bug tracker & be sure to include all requested information.
{% endtrans %}</div>
{% endmacro %}