8000 Merge remote-tracking branch 'kivy-p4a/master' · sam-qian/python-for-android@a194a5b · GitHub
[go: up one dir, main page]

Skip to content < 8000 span style="width: 0%;" data-view-component="true" class="Progress-item progress-pjax-loader-bar left-0 top-0 color-bg-accent-emphasis">

Commit a194a5b

Browse files
committed
Merge remote-tracking branch 'kivy-p4a/master'
2 parents 2d3040d + 8a8d04f commit a194a5b

File tree

14 files changed

+32
-46
lines changed

14 files changed

+32
-46
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ before_script:
3232

3333
script:
3434
- docker build --tag=p4a --file Dockerfile.py3 .
35-
- docker run p4a /bin/sh -c "$COMMAND"
35+
- docker run -e CI p4a /bin/sh -c "$COMMAND"

doc/source/recipes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ install`` with an appropriate environment.
251251
For instance, the following is all that's necessary to create a recipe
252252
for the Vispy module::
253253

254-
from pythonforandroid.toolchain import PythonRecipe
254+
from pythonforandroid.recipe import PythonRecipe
255255
class VispyRecipe(PythonRecipe):
256256
version = 'master'
257257
url = 'https://github.com/vispy/vispy/archive/{version}.zip'

pythonforandroid/bootstraps/common/build/src/main/java/org/kivy/android/PythonService.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ public void onTaskRemoved(Intent rootIntent) {
144144
public void run(){
145145
String app_root = getFilesDir().getAbsolutePath() + "/app";
146146
File app_root_file = new File(app_root);
147-
PythonUtil.loadLibraries(app_root_file);
147+
PythonUtil.loadLibraries(app_root_file,
148+
new File(getApplicationInfo().nativeLibraryDir));
148149
this.mService = this;
149150
nativeStart(
150151
androidPrivate, androidArgument,

pythonforandroid/bootstraps/common/build/src/main/java/org/kivy/android/PythonUtil.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,7 @@ protected static void addLibraryIfExists(ArrayList<String> libsList, String patt
3030
}
3131
}
3232

33-
protected static ArrayList<String> getLibraries(File filesDir) {
34-
35-
String libsDirPath = filesDir.getParentFile().getParentFile().getAbsolutePath() + "/lib/";
36-
File libsDir = new File(libsDirPath);
37-
33+
protected static ArrayList<String> getLibraries(File libsDir) {
3834
ArrayList<String> libsList = new ArrayList<String>();
3935
addLibraryIfExists(libsList, "crystax", libsDir);
4036
addLibraryIfExists(libsList, "sqlite3", libsDir);
@@ -49,14 +45,13 @@ protected static ArrayList<String> getLibraries(File filesDir) {
4945
return libsList;
5046
}
5147

52-
public static void loadLibraries(File filesDir) {
53-
48+
public static void loadLibraries(File filesDir, File libsDir) {
5449
String filesDirPath = filesDir.getAbsolutePath();
5550
boolean foundPython = false;
5651

57-
for (String lib : getLibraries(filesDir)) {
52+
for (String lib : getLibraries(libsDir)) {
5853
Log.v(TAG, "Loading library: " + lib);
59-
try {
54+
try {
6055
System.loadLibrary(lib);
6156
if (lib.startsWith("python")) {
6257
foundPython = true;

pythonforandroid/bootstraps/sdl2/build/src/main/java/org/kivy/android/PythonActivity.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ protected void onCreate(Bundle savedInstanceState) {
8383
public void loadLibraries() {
8484
String app_root = new String(getAppRoot());
8585
File app_root_file = new File(app_root);
86-
PythonUtil.loadLibraries(app_root_file);
86+
PythonUtil.loadLibraries(app_root_file,
87+
new File(getApplicationInfo().nativeLibraryDir));
8788
}
8889

8990
public void recursiveDelete(File f) {

pythonforandroid/bootstraps/sdl2/build/src/main/java/org/kivy/android/PythonUtil.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,7 @@ protected static void addLibraryIfExists(ArrayList<String> libsList, String patt
2929
}
3030
}
3131

32-
protected static ArrayList<String> getLibraries(File filesDir) {
33-
34-
String libsDirPath = filesDir.getParentFile().getParentFile().getAbsolutePath() + "/lib/";
35-
File libsDir = new File(libsDirPath);
36-
32+
protected static ArrayList<String> getLibraries(File libsDir) {
3733
ArrayList<String> libsList = new ArrayList<String>();
3834
addLibraryIfExists(libsList, "crystax", libsDir);
3935
addLibraryIfExists(libsList, "sqlite3", libsDir);
@@ -52,14 +48,13 @@ protected static ArrayList<String> getLibraries(File filesDir) {
5248
return libsList;
5349
}
5450

55-
public static void loadLibraries(File filesDir) {
56-
51+
public static void loadLibraries(File filesDir, File libsDir) {
5752
String filesDirPath = filesDir.getAbsolutePath();
5853
boolean foundPython = false;
5954

60-
for (String lib : getLibraries(filesDir)) {
55+
for (String lib : getLibraries(libsDir)) {
6156
Log.v(TAG, "Loading library: " + lib);
62-
try {
57+
try {
6358
System.loadLibrary(lib);
6459
if (lib.startsWith("python")) {
6560
foundPython = true;

pythonforandroid/bootstraps/service_only/build/src/main/java/org/kivy/android/PythonActivity.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,8 @@ public void onDestroy() {
201201
public void loadLibraries() {
202202
String app_root = new String(getAppRoot());
203203
File app_root_file = new File(app_root);
204-
PythonUtil.loadLibraries(app_root_file);
204+
PythonUtil.loadLibraries(app_root_file,
205+
new File(getApplicationInfo().nativeLibraryDir));
205206
}
206207

207208
public void recursiveDelete(File f) {

pythonforandroid/bootstraps/webview/build/src/main/java/org/kivy/android/PythonActivity.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,8 @@ public void onDestroy() {
232232
public void loadLibraries() {
233233
String app_root = new String(getAppRoot());
234234
File app_root_file = new File(app_root);
235-
PythonUtil.loadLibraries(app_root_file);
235+
PythonUtil.loadLibraries(app_root_file,
236+
new File(getApplicationInfo().nativeLibraryDir));
236237
}
237238

238239
public void recursiveDelete(File f) {

pythonforandroid/logger.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,12 @@ def shprint(command, *args, **kwargs):
188188
'\t', ' ').replace(
189189
'\b', ' ').rstrip()
190190
if msg:
191-
stdout.write(u'{}\r{}{:<{width}}'.format(
192-
Err_Style.RESET_ALL, msg_hdr,
193-
shorten_string(msg, msg_width), width=msg_width))
194-
stdout.flush()
195-
need_closing_newline = True
191+
if "CI" not in os.environ:
192+
stdout.write(u'{}\r{}{:<{width}}'.format(
193+
Err_Style.RESET_ALL, msg_hdr,
194+
shorten_string(msg, msg_width), width=msg_width))
195+
stdout.flush()
196+
need_closing_newline = True
196197
else:
197198
logger.debug(''.join(['\t', line.rstrip()]))
198199
if need_closing_newline:

pythonforandroid/recipe.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,9 @@ def report_hook(index, blksize, size):
140140
else:
141141
progression = '{0:.2f}%'.format(
142142
index * blksize * 100. / float(size))
143-
stdout.write('- Download {}\r'.format(progression))
144-
stdout.flush()
143+
if "CI" not in environ:
144+
stdout.write('- Download {}\r'.format(progression))
145+
stdout.flush()
145146

146147
if exists(target):
147148
unlink(target)

0 commit comments

Comments
 (0)
0