(cmake) new python code is optional and enabled at cmake time with -DUSE_PYTHON=1

This commit is contained in:
Benjamin Sergeant
2020-06-25 10:05:02 -07:00
parent f8b8799799
commit 68c97da518
8 changed files with 62 additions and 44 deletions

View File

@ -23,18 +23,18 @@
// (linking error about missing debug build)
//
#ifndef _WIN32
#ifdef IXBOTS_USE_PYTHON
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#endif
#ifndef _WIN32
#ifdef IXBOTS_USE_PYTHON
namespace
{
//
// This function is unused at this point. It produce a correct output,
// but triggers memory leaks when called repeateadly, as the reference counting
// Python functions are not used properly
// but triggers memory leaks when called repeateadly, as I cannot figure out how to
// make the reference counting Python functions to work properly (Py_DECREF and friends)
//
PyObject* jsonToPythonObject(const Json::Value& val)
{
@ -104,8 +104,9 @@ namespace ix
StatsdClient& statsdClient,
const std::string& scriptPath)
{
#ifdef _WIN32
CoreLogger::error("Command is disabled on Windows.");
#ifndef IXBOTS_USE_PYTHON
CoreLogger::error("Command is disabled. "
"Needs to be configured with USE_PYTHON=1");
return -1;
#else
CobraBot bot;