Skip to content

Commit f1e6273

Browse files
author
Naranjo Manuel Francisco
committed
Only install scripts in the all-in-one-apk version, setup PYTHONUSERBASE so .pth files are been found
1 parent d0fdeb8 commit f1e6273

1 file changed

Lines changed: 12 additions & 42 deletions

File tree

android/PythonForAndroid/src/com/googlecode/pythonforandroid/PythonDescriptor.java

Lines changed: 12 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,16 @@ public class PythonDescriptor extends Sl4aHostedInterpreter {
3737
private static final String ENV_LD = "LD_LIBRARY_PATH";
3838
private static final String ENV_EXTRAS = "PY4A_EXTRAS";
3939
private static final String ENV_EGGS = "PYTHON_EGG_CACHE";
40+
private static final String ENV_USERBASE="PYTHONUSERBASE";
4041
private static final String BASE_URL = "http://python-for-android.googlecode.com/";
4142
private static final int LATEST_VERSION = -1;
42-
private boolean offline = false;
43-
private int cache_version = -1;
44-
private int cache_extras_version = -1;
4543
private int cache_scripts_version = -1;
4644

45+
@Override
46+
public int getVersion() {
47+
return 16;
48+
}
49+
4750
@Override
4851
public String getBaseInstallUrl() {
4952
return BASE_URL + "/files/";
@@ -70,7 +73,7 @@ public boolean hasExtrasArchive() {
7073
}
7174

7275
public boolean hasScriptsArchive() {
73-
return !offline;
76+
return true;
7477
}
7578

7679
private int __resolve_version(String what) {
@@ -88,31 +91,6 @@ private int __resolve_version(String what) {
8891
return LATEST_VERSION;
8992
}
9093

91-
public int getVersion() {
92-
cache_version = __resolve_version("");
93-
return cache_version;
94-
}
95-
96-
public int getVersion(boolean usecache) {
97-
if (usecache && cache_version > -1) {
98-
return cache_version;
99-
}
100-
return this.getVersion();
101-
}
102-
103-
@Override
104-
public int getExtrasVersion() {
105-
cache_extras_version = __resolve_version("_extra");
106-
return cache_extras_version;
107-
}
108-
109-
public int getExtrasVersion(boolean usecache) {
110-
if (usecache && cache_extras_version > -1) {
111-
return cache_extras_version;
112-
}
113-
return this.getExtrasVersion();
114-
}
115-
11694
@Override
11795
public int getScriptsVersion() {
11896
cache_scripts_version = __resolve_version("_scripts");
@@ -160,21 +138,13 @@ private String getTemp() {
160138
public Map<String, String> getEnvironmentVariables(Context context) {
161139
Map<String, String> values = new HashMap<String, String>();
162140
values.put(ENV_HOME, getHome(context));
163-
values.put(ENV_LD, new File(getHome(context), "python/lib").getAbsolutePath());
164-
values.put(ENV_PATH, new File(getHome(context), "python/lib/python2.6/python.zip/python") + ":"
165-
+ new File(getHome(context), "python/lib/python2.6/lib-dynload"));
166-
values.put(ENV_EGGS,
167-
new File(getHome(context), "python/lib/python2.6/lib-dynload").getAbsolutePath());
141+
values.put(ENV_LD, new File(getHome(context), "lib").getAbsolutePath());
142+
values.put(ENV_PATH, new File(getHome(context), "lib/python2.6/python.zip/python") + ":"
143+
+ new File(getHome(context), "lib/python2.6/lib-dynload"));
144+
values.put(ENV_EGGS, new File(getHome(context), "lib/python2.6/lib-dynload").getAbsolutePath());
168145
values.put(ENV_EXTRAS, getExtrasRoot());
146+
values.put(ENV_USERBASE, getHome(context));
169147
values.put(ENV_TEMP, getTemp());
170148
return values;
171149
}
172-
173-
public void setOffline(boolean offline) {
174-
this.offline = offline;
175-
}
176-
177-
public boolean getOffline() {
178-
return offline;
179-
}
180150
}

0 commit comments

Comments
 (0)