mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-16 01:19:57 +00:00
Python Startup 1 of 2 Windows Fixups
.. fixup trivial issues like PATHSEP and separators in general. .. it seems that Py_SetProgramName will drive the initialisation of the Python interpreter to set sys.path, sys.prefix and sys.exec_prefix. .. rather than trying to fixup these directly instead we set the program name to the python installed binary (full path). .. you still need python in your path, will fixup in part 2. .. lastly, also added a 'printd' macro to embed debug info, which can be enabled in gcconfig.pri via DEFINES += PYTHON_DEBUG=true
This commit is contained in:
@@ -38,8 +38,9 @@ class PythonEmbed {
|
||||
PythonEmbed(const bool verbose=false, const bool interactive=false);
|
||||
~PythonEmbed();
|
||||
|
||||
static bool pythonInstalled(QString &home, QString &pypath);
|
||||
QString pyhome, pypath;
|
||||
// find installed binary and check version and module path
|
||||
static bool pythonInstalled(QString &pybin, QString &pypath);
|
||||
QString pybin, pypath;
|
||||
|
||||
// scripts can set a result value
|
||||
double result;
|
||||
@@ -78,4 +79,26 @@ class PythonEmbed {
|
||||
long threadid;
|
||||
};
|
||||
|
||||
// embed debugging via 'printd' and enable via PYTHON_DEBUG
|
||||
#ifndef PYTHON_DEBUG
|
||||
#define PYTHON_DEBUG false
|
||||
#endif
|
||||
#ifdef Q_CC_MSVC
|
||||
#define printd(fmt, ...) do { \
|
||||
if (PYTHON_DEBUG) { \
|
||||
printf("[%s:%d %s] " fmt , __FILE__, __LINE__, \
|
||||
__FUNCTION__, __VA_ARGS__); \
|
||||
fflush(stdout); \
|
||||
} \
|
||||
} while(0)
|
||||
#else
|
||||
#define printd(fmt, args...) \
|
||||
do { \
|
||||
if (PYTHON_DEBUG) { \
|
||||
printf("[%s:%d %s] " fmt , __FILE__, __LINE__, \
|
||||
__FUNCTION__, ##args); \
|
||||
fflush(stdout); \
|
||||
} \
|
||||
} while(0)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user