Remove dependency_links support again
Doesn't work reliably across pip versions, and adding a special rule for each and every version also isn't fun. Plugin authors will need to use a different approach for pulling in dependencies that are not on pypi during install, e.g. extra install urls or something like that. For now, I give up here ;)
This commit is contained in:
parent
5decb23f23
commit
be423e49fd
4 changed files with 7 additions and 49 deletions
|
|
@ -39,7 +39,6 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
|
||||||
self._pending_uninstall = set()
|
self._pending_uninstall = set()
|
||||||
|
|
||||||
self._pip_caller = None
|
self._pip_caller = None
|
||||||
self._pip_version_dependency_links = pkg_resources.parse_version("1.5")
|
|
||||||
|
|
||||||
self._repository_available = False
|
self._repository_available = False
|
||||||
self._repository_plugins = []
|
self._repository_plugins = []
|
||||||
|
|
@ -75,8 +74,7 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
|
||||||
return dict(
|
return dict(
|
||||||
repository="http://plugins.octoprint.org/plugins.json",
|
repository="http://plugins.octoprint.org/plugins.json",
|
||||||
repository_ttl=24*60,
|
repository_ttl=24*60,
|
||||||
pip=None,
|
pip=None
|
||||||
dependency_links=False
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def on_settings_save(self, data):
|
def on_settings_save(self, data):
|
||||||
|
|
@ -171,7 +169,6 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
|
||||||
plugin_name = data["plugin"] if "plugin" in data else None
|
plugin_name = data["plugin"] if "plugin" in data else None
|
||||||
return self.command_install(url=url,
|
return self.command_install(url=url,
|
||||||
force="force" in data and data["force"] in valid_boolean_trues,
|
force="force" in data and data["force"] in valid_boolean_trues,
|
||||||
dependency_links="dependency_links" in data and data["dependency_links"] in valid_boolean_trues,
|
|
||||||
reinstall=plugin_name)
|
reinstall=plugin_name)
|
||||||
|
|
||||||
elif command == "uninstall":
|
elif command == "uninstall":
|
||||||
|
|
@ -190,7 +187,7 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
|
||||||
plugin = self._plugin_manager.plugins[plugin_name]
|
plugin = self._plugin_manager.plugins[plugin_name]
|
||||||
return self.command_toggle(plugin, command)
|
return self.command_toggle(plugin, command)
|
||||||
|
|
||||||
def command_install(self, url=None, path=None, force=False, reinstall=None, dependency_links=False):
|
def command_install(self, url=None, path=None, force=False, reinstall=None):
|
||||||
if url is not None:
|
if url is not None:
|
||||||
pip_args = ["install", sarge.shell_quote(url)]
|
pip_args = ["install", sarge.shell_quote(url)]
|
||||||
elif path is not None:
|
elif path is not None:
|
||||||
|
|
@ -198,9 +195,6 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
|
||||||
else:
|
else:
|
||||||
raise ValueError("Either url or path must be provided")
|
raise ValueError("Either url or path must be provided")
|
||||||
|
|
||||||
if dependency_links or self._settings.get_boolean(["dependency_links"]):
|
|
||||||
pip_args.append("--process-dependency-links")
|
|
||||||
|
|
||||||
all_plugins_before = self._plugin_manager.find_plugins()
|
all_plugins_before = self._plugin_manager.find_plugins()
|
||||||
|
|
||||||
success_string = "Successfully installed"
|
success_string = "Successfully installed"
|
||||||
|
|
@ -409,10 +403,6 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
|
||||||
def _call_pip(self, args):
|
def _call_pip(self, args):
|
||||||
if self._pip_caller is None or not self._pip_caller.available:
|
if self._pip_caller is None or not self._pip_caller.available:
|
||||||
raise RuntimeError(u"No pip available, can't operate".format(**locals()))
|
raise RuntimeError(u"No pip available, can't operate".format(**locals()))
|
||||||
|
|
||||||
if "--process-dependency-links" in args and self._pip_caller < self._pip_version_dependency_links:
|
|
||||||
args.remove("--process-dependency-links")
|
|
||||||
|
|
||||||
return self._pip_caller.execute(*args)
|
return self._pip_caller.execute(*args)
|
||||||
|
|
||||||
def _log_call(self, *lines):
|
def _log_call(self, *lines):
|
||||||
|
|
@ -513,9 +503,6 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
|
||||||
def map_repository_entry(entry):
|
def map_repository_entry(entry):
|
||||||
result = dict(entry)
|
result = dict(entry)
|
||||||
|
|
||||||
if not "follow_dependency_links" in result:
|
|
||||||
result["follow_dependency_links"] = False
|
|
||||||
|
|
||||||
result["is_compatible"] = dict(
|
result["is_compatible"] = dict(
|
||||||
octoprint=True,
|
octoprint=True,
|
||||||
os=True
|
os=True
|
||||||
|
|
|
||||||
|
|
@ -70,8 +70,6 @@ $(function() {
|
||||||
self.loglines = ko.observableArray([]);
|
self.loglines = ko.observableArray([]);
|
||||||
self.installedPlugins = ko.observableArray([]);
|
self.installedPlugins = ko.observableArray([]);
|
||||||
|
|
||||||
self.followDependencyLinks = ko.observable(false);
|
|
||||||
|
|
||||||
self.working = ko.observable(false);
|
self.working = ko.observable(false);
|
||||||
self.workingTitle = ko.observable();
|
self.workingTitle = ko.observable();
|
||||||
self.workingDialog = undefined;
|
self.workingDialog = undefined;
|
||||||
|
|
@ -127,9 +125,6 @@ $(function() {
|
||||||
self.uploadButton.unbind("click");
|
self.uploadButton.unbind("click");
|
||||||
self.uploadButton.bind("click", function() {
|
self.uploadButton.bind("click", function() {
|
||||||
self._markWorking(gettext("Installing plugin..."), gettext("Installing plugin from uploaded archive..."));
|
self._markWorking(gettext("Installing plugin..."), gettext("Installing plugin from uploaded archive..."));
|
||||||
data.formData = {
|
|
||||||
dependency_links: self.followDependencyLinks()
|
|
||||||
};
|
|
||||||
data.submit();
|
data.submit();
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
@ -243,13 +238,13 @@ $(function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self.installed(data)) {
|
if (self.installed(data)) {
|
||||||
self.installPlugin(data.archive, data.title, data.id, data.follow_dependency_links || self.followDependencyLinks());
|
self.installPlugin(data.archive, data.title, data.id);
|
||||||
} else {
|
} else {
|
||||||
self.installPlugin(data.archive, data.title, undefined, data.follow_dependency_links || self.followDependencyLinks());
|
self.installPlugin(data.archive, data.title, undefined);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
self.installPlugin = function(url, name, reinstall, followDependencyLinks) {
|
self.installPlugin = function(url, name, reinstall) {
|
||||||
if (!self.loginState.isAdmin()) {
|
if (!self.loginState.isAdmin()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -263,10 +258,6 @@ $(function() {
|
||||||
}
|
}
|
||||||
if (!url) return;
|
if (!url) return;
|
||||||
|
|
||||||
if (followDependencyLinks === undefined) {
|
|
||||||
followDependencyLinks = self.followDependencyLinks();
|
|
||||||
}
|
|
||||||
|
|
||||||
var workTitle, workText;
|
var workTitle, workText;
|
||||||
if (!reinstall) {
|
if (!reinstall) {
|
||||||
workTitle = gettext("Installing plugin...");
|
workTitle = gettext("Installing plugin...");
|
||||||
|
|
@ -282,7 +273,7 @@ $(function() {
|
||||||
self._markWorking(workTitle, workText);
|
self._markWorking(workTitle, workText);
|
||||||
|
|
||||||
var command = "install";
|
var command = "install";
|
||||||
var payload = {url: url, dependency_links: followDependencyLinks};
|
var payload = {url: url};
|
||||||
if (reinstall) {
|
if (reinstall) {
|
||||||
payload["plugin"] = reinstall;
|
payload["plugin"] = reinstall;
|
||||||
payload["force"] = true;
|
payload["force"] = true;
|
||||||
|
|
|
||||||
|
|
@ -147,21 +147,6 @@
|
||||||
</div>
|
</div>
|
||||||
<span class="help-block" data-bind="visible: invalidArchive">{{ _('This does not look like a valid plugin archive. Valid plugin archives should be either zip files or tarballs and have the extension ".zip", ".tar.gz", ".tgz" or ".tar"') }}</span>
|
<span class="help-block" data-bind="visible: invalidArchive">{{ _('This does not look like a valid plugin archive. Valid plugin archives should be either zip files or tarballs and have the extension ".zip", ".tar.gz", ".tgz" or ".tar"') }}</span>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<div>
|
|
||||||
<div><small><a href="#" class="muted" onclick="$(this).children().toggleClass('icon-caret-right icon-caret-down').parent().parent().parent().next().slideToggle('fast')"><i class="icon-caret-right"></i> {{ _('Advanced options') }}</a></small></div>
|
|
||||||
<div class="hide">
|
|
||||||
<form class="form-horizontal">
|
|
||||||
<div class="control-group">
|
|
||||||
<div class="controls">
|
|
||||||
<label class="checkbox">
|
|
||||||
<input type="checkbox" data-bind="checked: followDependencyLinks"> {{ _('Use <code>--process-dependency-links</code> with <code>pip install</code>') }}
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button class="btn" data-dismiss="modal" aria-hidden="true">{{ _('Close') }}</button>
|
<button class="btn" data-dismiss="modal" aria-hidden="true">{{ _('Close') }}</button>
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ __copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms
|
||||||
|
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import pkg_resources
|
|
||||||
|
|
||||||
from octoprint.util.pip import PipCaller, UnknownPip
|
from octoprint.util.pip import PipCaller, UnknownPip
|
||||||
|
|
||||||
|
|
@ -15,7 +14,6 @@ logger = logging.getLogger("octoprint.plugins.softwareupdate.updaters.pip")
|
||||||
console_logger = logging.getLogger("octoprint.plugins.softwareupdate.updaters.pip.console")
|
console_logger = logging.getLogger("octoprint.plugins.softwareupdate.updaters.pip.console")
|
||||||
|
|
||||||
_pip_callers = dict()
|
_pip_callers = dict()
|
||||||
_pip_version_dependency_links = pkg_resources.parse_version("1.5")
|
|
||||||
|
|
||||||
def can_perform_update(target, check):
|
def can_perform_update(target, check):
|
||||||
pip_caller = _get_pip_caller(command=check["pip_command"] if "pip_command" in check else None)
|
pip_caller = _get_pip_caller(command=check["pip_command"] if "pip_command" in check else None)
|
||||||
|
|
@ -51,12 +49,9 @@ def perform_update(target, check, target_version):
|
||||||
logger.debug("Target: %s, executing pip install %s" % (target, install_arg))
|
logger.debug("Target: %s, executing pip install %s" % (target, install_arg))
|
||||||
pip_args = ["install", check["pip"].format(target_version=target_version, target=target_version)]
|
pip_args = ["install", check["pip"].format(target_version=target_version, target=target_version)]
|
||||||
|
|
||||||
if "dependency_links" in check and check["dependency_links"] and pip_caller >= _pip_version_dependency_links:
|
|
||||||
pip_args += ["--process-dependency-links"]
|
|
||||||
|
|
||||||
pip_caller.execute(*pip_args)
|
pip_caller.execute(*pip_args)
|
||||||
|
|
||||||
logger.debug("Target. %s, executing pip install %s --ignore-reinstalled --force-reinstall --no-deps" % (target, install_arg))
|
logger.debug("Target: %s, executing pip install %s --ignore-reinstalled --force-reinstall --no-deps" % (target, install_arg))
|
||||||
pip_args += ["--ignore-installed", "--force-reinstall", "--no-deps"]
|
pip_args += ["--ignore-installed", "--force-reinstall", "--no-deps"]
|
||||||
|
|
||||||
pip_caller.execute(*pip_args)
|
pip_caller.execute(*pip_args)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue