Files
znc/modules/modpython/compiler.cpp
darthgandalf 644632f915 Fix modpython to work with python 3.2
Thanks to nb for reporting and testing

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2214 726aef4b-f618-498e-8847-2d620e286838
2010-12-25 05:04:21 +00:00

25 lines
642 B
C++

/*
* Copyright (C) 2004-2010 See the AUTHORS file for details.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published
* by the Free Software Foundation.
*/
#include <Python.h>
int main(int argc, char** argv) {
Py_Initialize();
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;
}