99#define PY_SSIZE_T_CLEAN
1010#include "Python.h"
1111#ifndef Py_PYTHON_H
12- #error Python headers needed to compile C extensions, please install development version of Python.
12+ #error Python headers needed to compile C extensions, please install development version of Python.
1313#endif
1414
1515static PyObject * androidembed_log (PyObject * self , PyObject * args ) {
@@ -23,7 +23,7 @@ static PyObject *androidembed_log(PyObject *self, PyObject *args) {
2323
2424static PyMethodDef AndroidEmbedMethods [] = {
2525 {"log" , androidembed_log , METH_VARARGS ,
26- "Log on android platform" },
26+ "Log on android platform" },
2727 {NULL , NULL , 0 , NULL }
2828};
2929
@@ -35,7 +35,7 @@ int asset_extract(AAssetManager *am, char *src_file, char *dst_file) {
3535 FILE * fhd = fopen (dst_file , "wb" );
3636 if (fhd == NULL ) {
3737 LOGW ("Unable to open descriptor for %s (errno=%d:%s)" ,
38- dst_file , errno , strerror (errno ));
38+ dst_file , errno , strerror (errno ));
3939 return -1 ;
4040 }
4141
@@ -63,7 +63,7 @@ void android_main(struct android_app* state) {
6363 LOGI ("Initialize Python for Android" );
6464 //env_argument = getenv("ANDROID_ARGUMENT");
6565 //setenv("ANDROID_APP_PATH", env_argument, 1);
66- //setenv("PYTHONVERBOSE", "2", 1);
66+ //setenv("PYTHONVERBOSE", "2", 1);
6767 Py_SetProgramName ("python-android" );
6868 Py_Initialize ();
6969 //PySys_SetArgv(argc, argv);
@@ -138,20 +138,20 @@ void android_main(struct android_app* state) {
138138
139139 // test import site
140140 PyRun_SimpleString (
141- "import site; print site.getsitepackages()\n" \
142- "print 'Android path', sys.path\n" \
143- "print 'Android bootstrap done. __name__ is', __name__" );
141+ "import site; print site.getsitepackages()\n" \
142+ "print 'Android path', sys.path\n" \
143+ "print 'Android bootstrap done. __name__ is', __name__" );
144144
145145 /* run it !
146- */
146+ */
147147 LOGI ("Extract main.py from assets" );
148148 char main_fn [512 ];
149149 snprintf (main_fn , 512 , "%s/main.pyo" , state -> activity -> internalDataPath );
150150 if (asset_extract (am , "main.pyo" , main_fn ) < 0 )
151151 return ;
152152
153153 /* run python !
154- */
154+ */
155155 LOGI ("Run main.py >>>" );
156156 FILE * fhd = fopen (main_fn , "rb" );
157157 if (fhd == NULL ) {
@@ -166,12 +166,12 @@ void android_main(struct android_app* state) {
166166 LOGW ("An error occured." );
167167 PyErr_Print (); /* This exits with the right code if SystemExit. */
168168 if (Py_FlushLine ())
169- PyErr_Clear ();
169+ PyErr_Clear ();
170170 }
171171
172172 /* close everything
173- */
174- Py_Finalize ();
173+ */
174+ Py_Finalize ();
175175
176176 LOGW ("Python for android ended." );
177177}
0 commit comments