@@ -84,6 +84,11 @@ int main(int argc, char *argv[]) {
84
84
setenv ("ANDROID_APP_PATH" , env_argument , 1 );
85
85
env_entrypoint = getenv ("ANDROID_ENTRYPOINT" );
86
86
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
+ }
87
92
88
93
if (env_logname == NULL ) {
89
94
env_logname = "python" ;
@@ -104,12 +109,15 @@ int main(int argc, char *argv[]) {
104
109
105
110
LOGP ("Preparing to initialize python" );
106
111
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 )) {
108
116
LOGP ("crystax_python exists" );
109
117
char paths [256 ];
110
118
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 );
113
121
/* snprintf(paths, 256, "%s/stdlib.zip:%s/modules", env_argument,
114
122
* env_argument); */
115
123
LOGP ("calculated paths to be..." );
@@ -166,11 +174,11 @@ int main(int argc, char *argv[]) {
166
174
" argument ]\n" );
167
175
}
168
176
169
- if (dir_exists ("crystax_python" )) {
177
+ if (dir_exists (crystax_python_dir )) {
170
178
char add_site_packages_dir [256 ];
171
179
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 );
174
182
175
183
PyRun_SimpleString ("import sys\n"
176
184
"sys.argv = ['notaninterpreterreally']\n"
0 commit comments