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

Skip to content

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)

pythonforandroid/recipes/flask/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class FlaskRecipe(PythonRecipe):
99
version = '0.10.1'
1010
url = 'https://github.com/pallets/flask/archive/{version}.zip'
1111

12-
depends = [('python2', 'python3', 'python3crystax'), 'setuptools', 'genericndkbuild']
12+
depends = [('python2', 'python3', 'python3crystax'), 'setuptools']
1313

1414
python_depends = ['jinja2', 'werkzeug', 'markupsafe', 'itsdangerous', 'click']
1515

pythonforandroid/recipes/psycopg2/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
class Psycopg2Recipe(PythonRecipe):
77
"""
88
Requires `libpq-dev` system dependency e.g. for `pg_config` binary.
9+
If you get `nl_langinfo` symbol runtime error, make sure you're running on
10+
`ANDROID_API` (`ndk-api`) >= 26, see:
11+
https://github.com/kivy/python-for-android/issues/1711#issuecomment-465747557
912
"""
1013
version = 'latest'
1114
url = 'http://initd.org/psycopg/tarballs/psycopg2-{version}.tar.gz'
@@ -41,7 +44,7 @@ def install_python_package(self, arch, name=None, env=None, is_dir=True):
4144
_env=env)
4245
shprint(hostpython, 'setup.py', 'install', '-O2',
4346
'--root={}'.format(self.ctx.get_python_install_dir()),
44-
'--install-lib=lib/python2.7/site-packages', _env=env)
47+
'--install-lib=.', _env=env)
4548

4649

4750
recipe = Psycopg2Recipe()

pythonforandroid/recipes/sdl2_image/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from pythonforandroid.recipe import BootstrapNDKRecipe
2-
from pythonforandroid.patching import is_arch
32

43

54
class LibSDL2Image(BootstrapNDKRecipe):
@@ -8,7 +7,6 @@ class LibSDL2Image(BootstrapNDKRecipe):
87
dir_name = 'SDL2_image'
98

109
patches = ['toggle_jpg_png_webp.patch',
11-
('disable_jpg.patch', is_arch('x86')),
1210
'extra_cflags.patch',
1311
]
1412

pythonforandroid/recipes/sdl2_image/disable_jpg.patch

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)
0