znc/znc-0.097.svn2213-modpython.patch
2010-12-24 23:04:00 -06:00

24 lines
750 B
Diff

--- znc-0.097.svn2213/modules/modpython/compiler.cpp 2010-12-22 08:52:53.106613000 -0600
+++ znc-0.097.svn2213-fixed/modules/modpython/compiler.cpp 2010-12-24 22:49:47.076861076 -0600
@@ -8,9 +8,18 @@
#include <Python.h>
-int main() {
+int main(int argc, char** argv) {
Py_Initialize();
- int res = PyRun_SimpleString("import compileall; print('Optimizing python files for later use...'); compileall.compile_dir('.')");
+ int res = PyRun_SimpleString(
+ "import compileall\n"
+ "print('Optimizing python files for later use...')\n"
+ "import sys\n"
+ "if sys.version_info < (3, 2):\n"
+ " compileall.compile_dir('.')\n"
+ "else:\n"
+ " compileall.compile_dir('.', legacy=True)\n"
+ );
Py_Finalize();
return res;
}
+