22 #include "qgspythonutils.h" 33 static QStringList *pluginList =
new QStringList();
41 QString pythonlibName( QStringLiteral(
"qgispython" ) );
42 #if defined(Q_OS_UNIX) 46 pythonlibName.prepend(
"lib" );
50 QLibrary pythonlib( pythonlibName, version );
53 pythonlib.setLoadHints( QLibrary::ResolveAllSymbolsHint | QLibrary::ExportExternalSymbolsHint );
54 if ( !pythonlib.load() )
56 pythonlib.setFileName( pythonlibName );
57 if ( !pythonlib.load() )
65 typedef QgsPythonUtils*( *inst )();
66 inst pythonlib_inst = ( inst )
cast_to_fptr( pythonlib.resolve(
"instance" ) );
67 if ( !pythonlib_inst )
70 QgsDebugMsg( QStringLiteral(
"Couldn't resolve python support library's instance() symbol." ) );
74 QgsDebugMsg( QStringLiteral(
"Python support library's instance() symbol resolved." ) );
80 QgsDebugMsg( QStringLiteral(
"Python support ENABLED :-)" ) );
84 QgsDebugMsg( QStringLiteral(
"Python support FAILED :-(" ) );
90 bool atLeastOneEnabled =
false;
91 for (
const QString &pluginName :
sPythonUtils->pluginList() )
93 QString pluginService =
sPythonUtils->getPluginMetadata( pluginName, QStringLiteral(
"server" ) );
94 if ( pluginService == QLatin1String(
"True" ) )
100 atLeastOneEnabled =
true;
static QString libraryPath()
Returns the path containing qgis_core, qgis_gui, qgispython (and other) libraries.
static bool initPlugins(QgsServerInterface *interface)
Initializes the Python plugins.
static const int QGIS_VERSION_INT
Version number used for comparing versions using the "Check QGIS Version" function.
static void logMessage(const QString &message, const QString &tag=QString(), Qgis::MessageLevel level=Qgis::Warning, bool notifyUser=true)
Adds a message to the log instance (and creates it if necessary).
static QgsPythonUtils * sPythonUtils
Pointer to QgsPythonUtils.
QgsServerInterface Class defining interfaces exposed by QGIS Server and made available to plugins...
static QStringList & serverPlugins()
List of available server plugin names.