Skip to content

Commit 7dab826

Browse files
committed
Merge branch 'master' into local
2 parents c473d5f + 4ddf1ae commit 7dab826

File tree

1 file changed

+14
-6
lines changed
  • pythonforandroid/bootstraps/sdl2/build/jni/src

1 file changed

+14
-6
lines changed

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

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@ int main(int argc, char *argv[]) {
8484
setenv("ANDROID_APP_PATH", env_argument, 1);
8585
env_entrypoint = getenv("ANDROID_ENTRYPOINT");
8686
env_logname = getenv("PYTHON_NAME");
87+
88+
if (!getenv("ANDROID_UNPACK")) {
89+
/* ANDROID_UNPACK currently isn't set in services */
90+
setenv("ANDROID_UNPACK", env_argument, 1);
91+
}
8792

8893
if (env_logname == NULL) {
8994
env_logname = "python";
@@ -104,12 +109,15 @@ int main(int argc, char *argv[]) {
104109

105110
LOGP("Preparing to initialize python");
106111

107-
if (dir_exists("crystax_python/")) {
112+
char crystax_python_dir[256];
113+
snprintf(crystax_python_dir, 256,
114+
"%s/crystax_python", getenv("ANDROID_UNPACK"));
115+
if (dir_exists(crystax_python_dir)) {
108116
LOGP("crystax_python exists");
109117
char paths[256];
110118
snprintf(paths, 256,
111-
"%s/crystax_python/stdlib.zip:%s/crystax_python/modules",
112-
env_argument, env_argument);
119+
"%s/stdlib.zip:%s/modules",
120+
crystax_python_dir, crystax_python_dir);
113121
/* snprintf(paths, 256, "%s/stdlib.zip:%s/modules", env_argument,
114122
* env_argument); */
115123
LOGP("calculated paths to be...");
@@ -166,11 +174,11 @@ int main(int argc, char *argv[]) {
166174
" argument ]\n");
167175
}
168176

169-
if (dir_exists("crystax_python")) {
177+
if (dir_exists(crystax_python_dir)) {
170178
char add_site_packages_dir[256];
171179
snprintf(add_site_packages_dir, 256,
172-
"sys.path.append('%s/crystax_python/site-packages')",
173-
env_argument);
180+
"sys.path.append('%s/site-packages')",
181+
crystax_python_dir);
174182

175183
PyRun_SimpleString("import sys\n"
176184
"sys.argv = ['notaninterpreterreally']\n"

0 commit comments

Comments
 (0)