diff options
| author | 2017-08-26 15:02:56 +0200 | |
|---|---|---|
| committer | 2017-08-26 15:02:56 +0200 | |
| commit | dbe8ef6dad916124c3714abc469403ed9991261c (patch) | |
| tree | bc5625e1bd114f6b428444481d5a5f8088daf2f1 /src/modules/python | |
| parent | remove blank part of the splash img (diff) | |
| download | KVIrc-dbe8ef6dad916124c3714abc469403ed9991261c.tar.gz KVIrc-dbe8ef6dad916124c3714abc469403ed9991261c.tar.bz2 KVIrc-dbe8ef6dad916124c3714abc469403ed9991261c.zip | |
Add support for Python 3
Diffstat (limited to 'src/modules/python')
| -rw-r--r-- | src/modules/python/libkvipython.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/modules/python/libkvipython.cpp b/src/modules/python/libkvipython.cpp index 6bdd56a80..700e8939b 100644 --- a/src/modules/python/libkvipython.cpp +++ b/src/modules/python/libkvipython.cpp @@ -502,6 +502,31 @@ static bool python_kvs_fnc_isAvailable(KviKvsModuleFunctionCall * c) return true; } +/* + @doc: python.version + @type: + function + @title: + $python.version + @short: + Check which version of Python is supported in this build of KVIrc + @syntax: + $python.version + @description: + Returns which major version of Python is KVIrc linked to ([b]2[/b] or [b]3[/b]) + or [b]0[/b] if Python is not supported at all. +*/ + +static bool python_kvs_fnc_version(KviKvsModuleFunctionCall * c) +{ +#ifdef COMPILE_PYTHON_SUPPORT + c->returnValue()->setInteger(PY_MAJOR_VERSION); +#else + c->returnValue()->setBoolean(false); +#endif + return true; +} + static bool python_module_init(KviModule * m) { // register the command anyway @@ -509,6 +534,7 @@ static bool python_module_init(KviModule * m) KVSM_REGISTER_SIMPLE_COMMAND(m, "destroy", python_kvs_cmd_destroy); KVSM_REGISTER_FUNCTION(m, "isAvailable", python_kvs_fnc_isAvailable); + KVSM_REGISTER_FUNCTION(m, "version", python_kvs_fnc_version); #ifdef COMPILE_PYTHON_SUPPORT g_pPythonCoreModule = g_pModuleManager->getModule("pythoncore"); #endif |
