8000 Modified start.c to compile with both py2 and py3 · latin1593/python-for-android@21d7457 · GitHub
[go: up one dir, main page]

Skip to content

Commit 21d7457

Browse files
committed
Modified start.c to compile with both py2 and py3
1 parent cecdfc8 commit 21d7457

File tree

1 file changed

+8
-5
lines changed
  • pythonforandroid/bootstraps/sdl2/build/jni/src

1 file changed

+8
-5
lines changed

pythonforandroid/bootstraps/sdl2/build/jni/src/start.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,9 @@ int main(int argc, char *argv[]) {
171171

172172
Py_Initialize();
173173

174-
if (dir_exists("private/")) {
175-
PySys_SetArgv(argc, argv);
176-
}
174+
#if PY_MAJOR_VERSION < 3
175+
PySys_SetArgv(argc, argv);
176+
#endif
177177

178178
LOG("Initialized python");
179179

@@ -193,8 +193,9 @@ int main(int argc, char *argv[]) {
193193
* replace sys.path with our path
194194
*/
195195
PyRun_SimpleString("import sys, posix\n");
196-
if (dir_exists("private/")) {
196+
if (dir_exists("lib")) {
197197
/* If we built our own python, set up the paths correctly */
198+
LOG("Setting up python from ANDROID_PRIVATE");
198199
PyRun_SimpleString(
199200
"private = posix.environ['ANDROID_PRIVATE']\n" \
200201
"argument = posix.environ['ANDROID_ARGUMENT']\n" \
@@ -204,7 +205,9 @@ int main(int argc, char *argv[]) {
204205
" private + '/lib/python2.7/lib-dynload/', \n" \
205206
" private + '/lib/python2.7/site-packages/', \n" \
206207
" argument ]\n");
207-
} else {
208+
}
209+
210+
if (dir_exists("crystax_python")) {
208211
char add_site_packages_dir[256];
209212
snprintf(add_site_packages_dir, 256, "sys.path.append('%s/crystax_python/site-packages')",
210213
env_argument);

0 commit comments

Comments
 (0)
0