diff options
author | Eike Ziller <eike.ziller@qt.io> | 2018-09-14 16:21:08 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2018-09-17 10:52:11 +0000 |
commit | 9e10b05850ee3a42513a334e66f61b37e02691e8 (patch) | |
tree | 471c09fb9ff584488a15453e528257b7e61e9075 /plugins | |
parent | a33fc09a091f73ca3cc3192dfc88218883aed1c9 (diff) |
Remove unnecessary "setup.py" mechanism for initializing extensions
There already is the requirements.txt mechanism that takes care of pip
installing in the right way.
Setup for which this is not sufficient should be possible to do in the
initialization code of the extension directly. Additionally the provided
example was broken (e.g. didn't work with spaces in paths), and the
whole mechanism had the encapsulation problem that the extensions
themselves had before they were made modules/packages.
Change-Id: I8692e26e65ec667267c7918e6edbd32f55534bc8
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/pythonextensions/pythonextensionsplugin.cpp | 28 | ||||
-rw-r--r-- | plugins/pythonextensions/pythonextensionsplugin.h | 1 |
2 files changed, 0 insertions, 29 deletions
diff --git a/plugins/pythonextensions/pythonextensionsplugin.cpp b/plugins/pythonextensions/pythonextensionsplugin.cpp index f0ddcc5..bb8c18a 100644 --- a/plugins/pythonextensions/pythonextensionsplugin.cpp +++ b/plugins/pythonextensions/pythonextensionsplugin.cpp @@ -105,8 +105,6 @@ bool PythonExtensionsPlugin::delayedInitialize() initializeOptionalBindings(); // Pip install any requirements known for the script installRequirements(); - // Run the setup for each extension that requires it - setupPythonExtensions(); // Python plugins are initialized here, to avoid blocking on startup initializePythonExtensions(); return true; @@ -225,32 +223,6 @@ void PythonExtensionsPlugin::installRequirements() } } -void PythonExtensionsPlugin::setupPythonExtensions() -{ - // Run the setup.py file for all extensions that provide it. - // later, there might be a way to determine if the setup needs - // to run. - QDir extension_dir = extensionDir(); - if (!extension_dir.exists()) - return; - - QStringList extension_list = extensionList(); - for (const QString &extension : extension_list) { - QFile extension_setup(extension_dir.absolutePath() + "/" + extension + "/setup.py"); - if (extension_setup.open(QIODevice::ReadOnly)) { - QTextStream in(&extension_setup); - QString setup_code = in.readAll(); - if (!PyUtil::runScriptWithPath( - setup_code.toStdString(), - QString(extension_dir.absolutePath() + "/" + extension).toStdString() - )) { - qWarning() << "Failed to setup extension" << extension; - Core::MessageManager::write(Constants::MESSAGE_MANAGER_PREFIX + tr("Failed to setup extension ") + extension); - } - } - } -} - void PythonExtensionsPlugin::initializePythonExtensions() { // Search python directory in plugin paths diff --git a/plugins/pythonextensions/pythonextensionsplugin.h b/plugins/pythonextensions/pythonextensionsplugin.h index a920911..053fbc2 100644 --- a/plugins/pythonextensions/pythonextensionsplugin.h +++ b/plugins/pythonextensions/pythonextensionsplugin.h @@ -58,7 +58,6 @@ private: void initializePythonBindings(); void initializeOptionalBindings(); void installRequirements(); - void setupPythonExtensions(); void initializePythonExtensions(); }; |