23 #include "qgspythonutils.h" 35 static QStringList *pluginList =
new QStringList();
43 QString pythonlibName( QStringLiteral(
"qgispython" ) );
44 #if defined(Q_OS_UNIX) 48 pythonlibName.prepend(
"lib" );
52 QLibrary pythonlib( pythonlibName, version );
55 pythonlib.setLoadHints( QLibrary::ResolveAllSymbolsHint | QLibrary::ExportExternalSymbolsHint );
56 if ( !pythonlib.load() )
58 pythonlib.setFileName( pythonlibName );
59 if ( !pythonlib.load() )
67 typedef QgsPythonUtils*( *inst )();
68 inst pythonlib_inst = ( inst )
cast_to_fptr( pythonlib.resolve(
"instance" ) );
69 if ( !pythonlib_inst )
72 QgsDebugMsg( QStringLiteral(
"Couldn't resolve python support library's instance() symbol." ) );
76 QgsDebugMsg( QStringLiteral(
"Python support library's instance() symbol resolved." ) );
82 QgsDebugMsg( QStringLiteral(
"Python support ENABLED :-)" ) );
86 QgsDebugMsg( QStringLiteral(
"Python support FAILED :-(" ) );
92 bool atLeastOneEnabled =
false;
93 for (
const QString &pluginName :
sPythonUtils->pluginList() )
95 QString pluginService =
sPythonUtils->getPluginMetadata( pluginName, QStringLiteral(
"server" ) );
96 if ( pluginService == QLatin1String(
"True" ) )
102 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.