ensure that site it not touched, and indicate this build is an ios build + ensure threads are correctly initialized (for further extensions like ffmpeg)

This commit is contained in:
Mathieu Virbel 2011-12-06 18:10:13 +01:00
parent 3f8b91143d
commit bc78020481

View file

@ -18,22 +18,24 @@ int main(int argc, char *argv[]) {
// because the process will not have write attribute on the device.
putenv("PYTHONOPTIMIZE=2");
putenv("PYTHONDONTWRITEBYTECODE=1");
putenv("PYTHONNOUSERSITE=1");
// Kivy environment to prefer some implementation on ios platform
putenv("KIVY_BUILD=ios");
putenv("KIVY_WINDOW=sdl");
putenv("KIVY_IMAGE=osxcoreimage");
NSLog(@"Initializing python");
Py_Initialize();
// If other modules are using thread, we need to initialize them before.
PyEval_InitThreads();
NSString * resourcePath = [[NSBundle mainBundle] resourcePath];
NSLog(@"PythonHome is: %s", (char *)[resourcePath UTF8String]);
Py_SetPythonHome((char *)[resourcePath UTF8String]);
NSLog(@"Initializing python");
Py_Initialize();
PySys_SetArgv(argc, argv);
// If other modules are using thread, we need to initialize them before.
PyEval_InitThreads();
// Search and start main.py
const char * prog = [
[[NSBundle mainBundle] pathForResource:@"YourApp/main" ofType:@"py"] cStringUsingEncoding: