Commit 13b46025 authored by Julius Künzel's avatar Julius Künzel 💬
Browse files

[Python Interface] Disable pip on Flatpak (we bundle the deps there)

This fixes a regression that blocks otio and sst features while
complaining about missing pip3

(cherry picked from commit f9ef095b)
parent 390af554
......@@ -42,23 +42,28 @@ PythonDependencyMessage::PythonDependencyMessage(QWidget *parent, AbstractPython
}
});
connect(m_interface, &AbstractPythonInterface::dependenciesMissing, this, [&](const QStringList &messages){
m_installAction->setEnabled(true);
m_installAction->setText(i18n("Install missing dependencies"));
addAction(m_installAction);
connect(m_interface, &AbstractPythonInterface::dependenciesMissing, this, [&](const QStringList &messages) {
if (!m_interface->installDisabled()) {
m_installAction->setEnabled(true);
m_installAction->setText(i18n("Install missing dependencies"));
addAction(m_installAction);
}
doShowMessage(messages.join(QStringLiteral("\n")), KMessageWidget::Warning);
});
connect(m_interface, &AbstractPythonInterface::proposeUpdate, this, [&](const QString &message){
// only allow upgrading python modules once
m_installAction->setText(i18n("Check for update"));
m_installAction->setEnabled(true);
addAction(m_installAction);
doShowMessage(message, KMessageWidget::Warning);
});
if (!m_interface->installDisabled()) {
connect(m_interface, &AbstractPythonInterface::proposeUpdate, this, [&](const QString &message) {
// only allow upgrading python modules once
m_installAction->setText(i18n("Check for update"));
m_installAction->setEnabled(true);
addAction(m_installAction);
doShowMessage(message, KMessageWidget::Warning);
});
}
connect(m_interface, &AbstractPythonInterface::dependenciesAvailable, this, [&](){
if (!m_updated) {
connect(m_interface, &AbstractPythonInterface::dependenciesAvailable, this, [&]() {
if (!m_updated && !m_interface->installDisabled()) {
// only allow upgrading python modules once
m_installAction->setText(i18n("Check for update"));
m_installAction->setEnabled(true);
......@@ -109,6 +114,7 @@ AbstractPythonInterface::AbstractPythonInterface(QObject *parent)
: QObject{parent}
, m_dependencies()
, m_versions(new QMap<QString, QString>())
, m_disableInstall(pCore->packageType() == QStringLiteral("flatpak"))
, m_scripts(new QMap<QString, QString>())
{
addScript(QStringLiteral("checkpackages.py"));
......@@ -138,7 +144,7 @@ bool AbstractPythonInterface::checkSetup()
"listed in PATH environment variable"));
return false;
}
if (m_pip3Exec.isEmpty()) {
if (m_pip3Exec.isEmpty() && !m_disableInstall) {
emit setupError(i18n("Cannot find pip3, please install it on your system.\n"
"If already installed, check it is installed in a directory "
"listed in PATH environment variable"));
......
......@@ -46,6 +46,7 @@ public:
QString runScript(const QString &scriptpath, QStringList args = {}, const QString &firstarg = {});
QString pythonExec() { return m_pyExec; };
void proposeMaybeUpdate(const QString &dependency, const QString &minVersion);
bool installDisabled(){return m_disableInstall};
friend class PythonDependencyMessage;
......@@ -55,6 +56,7 @@ private:
QMap<QString, QString> m_dependencies;
QStringList m_missing;
QMap<QString, QString> *m_versions;
bool m_disableInstall;
void installMissingDependencies();
QString locateScript(const QString &script);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment