Python 3.9.6 #11

Merged
akinwale merged 13 commits from python39 into master 2021-08-21 11:30:13 +02:00
34 changed files with 483 additions and 111 deletions

View file

@ -6,7 +6,7 @@ stages:
build arm64 aar:
stage: build
image: lbry/android-base:latest
image: lbry/android-base:python39
before_script:
- export BUILD_VERSION=$(cat $CI_PROJECT_DIR/src/main/python/main.py | grep --color=never -oP '([0-9]+\.?)+')
artifacts:
@ -31,7 +31,7 @@ build arm64 aar:
build arm aar:
stage: build2
image: lbry/android-base:latest
image: lbry/android-base:python39
before_script:
- export BUILD_VERSION=$(cat $CI_PROJECT_DIR/src/main/python/main.py | grep --color=never -oP '([0-9]+\.?)+')
artifacts:

View file

@ -39,7 +39,7 @@ version.filename = %(source.dir)s/main.py
# (list) Application requirements
# comma seperated e.g. requirements = sqlite3,kivy
requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2021.5.30, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, aioupnp==0.0.17, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, prometheus_client==0.8.0, "git+https://github.com/lbryio/lbry-sdk@v0.102.0#egg=lbry"
requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2021.5.30, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, aioupnp==0.0.17, asn1crypto, mock, netifaces, cryptography, aiohttp==3.6.0, multidict==4.5.2, idna, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, prometheus_client==0.8.0, "git+https://github.com/lbryio/lbry-sdk@v0.102.0#egg=lbry"
# (str) Custom source folders for requirements
# Sets custom source for any requirements with recipes

View file

@ -39,7 +39,7 @@ version.filename = %(source.dir)s/main.py
# (list) Application requirements
# comma seperated e.g. requirements = sqlite3,kivy
requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2021.5.30, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, aioupnp==0.0.17, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, prometheus_client==0.8.0, "git+https://github.com/lbryio/lbry-sdk@v0.102.0#egg=lbry"
requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2021.5.30, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, aioupnp==0.0.17, asn1crypto, mock, netifaces, cryptography, aiohttp==3.6.0, multidict==4.5.2, idna, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, prometheus_client==0.8.0, "git+https://github.com/lbryio/lbry-sdk@v0.102.0#egg=lbry"
# (str) Custom source folders for requirements
# Sets custom source for any requirements with recipes

View file

@ -39,7 +39,7 @@ version.filename = %(source.dir)s/main.py
# (list) Application requirements
# comma seperated e.g. requirements = sqlite3,kivy
requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2021.5.30, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, aioupnp==0.0.17, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, prometheus_client==0.8.0, "git+https://github.com/lbryio/lbry-sdk@v0.102.0#egg=lbry"
requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2021.5.30, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, aioupnp==0.0.17, asn1crypto, mock, netifaces, cryptography, aiohttp==3.6.0, multidict==4.5.2, idna, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, prometheus_client==0.8.0, "git+https://github.com/lbryio/lbry-sdk@v0.102.0#egg=lbry"
# (str) Custom source folders for requirements
# Sets custom source for any requirements with recipes

View file

@ -39,7 +39,7 @@ version.filename = %(source.dir)s/main.py
# (list) Application requirements
# comma seperated e.g. requirements = sqlite3,kivy
requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2021.5.30, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, prometheus_client==0.7.1, "git+https://github.com/lbryio/lbry-sdk@v0.102.0#egg=lbry"
requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2021.5.30, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.6.0, multidict==4.5.2, idna, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, prometheus_client==0.7.1, "git+https://github.com/lbryio/lbry-sdk@v0.102.0#egg=lbry"
# (str) Custom source folders for requirements
# Sets custom source for any requirements with recipes

View file

@ -0,0 +1,36 @@
FROM ubuntu:18.04
RUN export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
RUN dpkg --add-architecture i386
RUN apt-get -y update && apt-get -y install curl ca-certificates software-properties-common gpg-agent wget
RUN add-apt-repository ppa:deadsnakes/ppa -y
RUN apt-get -y update && apt-get -y install autoconf autogen automake libtool libffi-dev \
build-essential python3.7 python3.7-dev python3.7-venv python3-pip ccache git libncurses5:i386 libstdc++6:i386 \
libgtk2.0-0:i386 libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libidn11:i386 python2.7 python2.7-dev \
python-pip openjdk-8-jdk unzip zlib1g-dev zlib1g:i386 m4 libc6-dev-i386 gawk
RUN pip install --upgrade cython==0.28.1 setuptools zipp==1.2.0 importlib-resources==1.0.2 importlib-metadata==0.20 virtualenv==20.4.7
RUN git clone https://github.com/lbryio/buildozer.git
RUN cd buildozer && python2 setup.py install && cd ..
RUN mkdir -p cd ~/.buildozer/android/platform/
RUN wget 'https://dl.google.com/android/android-sdk_r23-linux.tgz' -P ~/.buildozer/android/platform/ && \
wget 'https://dl.google.com/android/repository/platform-28_r06.zip' -P ~/.buildozer/android/platform/ && \
wget 'https://dl.google.com/android/repository/build-tools_r28.0.3-linux.zip' -P ~/.buildozer/android/platform/ && \
tar -xvf ~/.buildozer/android/platform/android-sdk_r23-linux.tgz -C ~/.buildozer/android/platform/ && \
mv ~/.buildozer/android/platform/android-sdk-linux ~/.buildozer/android/platform/android-sdk-23 && \
unzip ~/.buildozer/android/platform/platform-28_r06.zip -d ~/.buildozer/android/platform/android-sdk-23/platforms && \
mv ~/.buildozer/android/platform/android-sdk-23/platforms/android-9 ~/.buildozer/android/platform/android-sdk-23/platforms/android-28 && \
mkdir -p ~/.buildozer/android/platform/android-sdk-23/build-tools && \
unzip ~/.buildozer/android/platform/build-tools_r28.0.3-linux.zip -d ~/.buildozer/android/platform/android-sdk-23/build-tools && \
mv ~/.buildozer/android/platform/android-sdk-23/build-tools/android-9 ~/.buildozer/android/platform/android-sdk-23/build-tools/28.0.3 && \
rm ~/.buildozer/android/platform/android-sdk_r23-linux.tgz && \
rm ~/.buildozer/android/platform/platform-28_r06.zip && \
rm ~/.buildozer/android/platform/build-tools_r28.0.3-linux.zip
RUN mkdir -p ~/.buildozer/android/platform/android-sdk-23/licenses && \
echo $'\n8933bad161af4178b1185d1a37fbf41ea5269c55\nd56f5187479451eabf01fb78af6dfcb131a6481e\n24333f8a63b6825ea9c5514f83c2829b004d1fee' > ~/.buildozer/android/platform/android-sdk-23/licenses/android-sdk-license
CMD ["/bin/bash"]

View file

@ -0,0 +1,41 @@
FROM ubuntu:18.04
RUN export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
RUN dpkg --add-architecture i386
RUN apt-get -y update && apt-get -y install curl ca-certificates software-properties-common gpg-agent wget
RUN add-apt-repository ppa:deadsnakes/ppa -y
RUN apt-get -y update && DEBIAN_FRONTEND=noninteractive apt-get -y install autoconf autogen automake libtool libffi-dev \
build-essential python3.9 python3.9-dev python3.9-venv python3-pip ccache git libncurses5:i386 libstdc++6:i386 \
libgtk2.0-0:i386 libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libidn11:i386 python2.7 python2.7-dev \
python-pip openjdk-8-jdk unzip zlib1g-dev zlib1g:i386 m4 libc6-dev-i386 gawk
RUN rm /usr/bin/python3 && ln -s /usr/bin/python3.9 /usr/bin/python3
RUN rm /usr/bin/python && ln -s /usr/bin/python2.7 /usr/bin/python
RUN pip install --upgrade cython==0.29.15 setuptools zipp==1.2.0 importlib-resources==1.0.2 importlib-metadata==0.20 virtualenv==20.4.7 appdirs sh colorama==0.3.3 jinja2 six pep517\<0.7.0 toml
RUN git clone https://github.com/lbryio/buildozer.git
RUN cd buildozer && python2 setup.py install && cd ..
RUN mkdir -p cd ~/.buildozer/android/platform/
RUN wget 'https://dl.google.com/android/android-sdk_r23-linux.tgz' -P ~/.buildozer/android/platform/ && \
wget 'https://dl.google.com/android/repository/platform-28_r06.zip' -P ~/.buildozer/android/platform/ && \
wget 'https://dl.google.com/android/repository/build-tools_r28.0.3-linux.zip' -P ~/.buildozer/android/platform/ && \
tar -xvf ~/.buildozer/android/platform/android-sdk_r23-linux.tgz -C ~/.buildozer/android/platform/ && \
mv ~/.buildozer/android/platform/android-sdk-linux ~/.buildozer/android/platform/android-sdk-23 && \
unzip ~/.buildozer/android/platform/platform-28_r06.zip -d ~/.buildozer/android/platform/android-sdk-23/platforms && \
mv ~/.buildozer/android/platform/android-sdk-23/platforms/android-9 ~/.buildozer/android/platform/android-sdk-23/platforms/android-28 && \
mkdir -p ~/.buildozer/android/platform/android-sdk-23/build-tools && \
unzip ~/.buildozer/android/platform/build-tools_r28.0.3-linux.zip -d ~/.buildozer/android/platform/android-sdk-23/build-tools && \
mv ~/.buildozer/android/platform/android-sdk-23/build-tools/android-9 ~/.buildozer/android/platform/android-sdk-23/build-tools/28.0.3 && \
rm ~/.buildozer/android/platform/android-sdk_r23-linux.tgz && \
rm ~/.buildozer/android/platform/platform-28_r06.zip && \
rm ~/.buildozer/android/platform/build-tools_r28.0.3-linux.zip
RUN mkdir -p ~/.buildozer/android/platform/android-sdk-23/licenses && \
echo $'\n8933bad161af4178b1185d1a37fbf41ea5269c55\nd56f5187479451eabf01fb78af6dfcb131a6481e\n24333f8a63b6825ea9c5514f83c2829b004d1fee' > ~/.buildozer/android/platform/android-sdk-23/licenses/android-sdk-license
RUN pip3 install --upgrade setuptools==51.0.0
CMD ["/bin/bash"]

View file

@ -76,7 +76,7 @@ public class PythonActivity extends SDLActivity {
public void loadLibraries() {
String app_root = new String(getAppRoot());
File app_root_file = new File(app_root);
PythonUtil.loadLibraries(app_root_file);
PythonUtil.loadLibraries(app_root_file, new File(getApplicationInfo().nativeLibraryDir));
}
public void recursiveDelete(File f) {

View file

@ -119,7 +119,7 @@ public class PythonService extends Service implements Runnable {
public void run(){
String app_root = getFilesDir().getAbsolutePath() + "/app";
File app_root_file = new File(app_root);
PythonUtil.loadLibraries(app_root_file);
PythonUtil.loadLibraries(app_root_file, new File(getApplicationInfo().nativeLibraryDir));
this.mService = this;
nativeStart(
androidPrivate, androidArgument,

View file

@ -1,33 +1,47 @@
package org.kivy.android;
import java.io.File;
import java.util.ArrayList;
import java.util.regex.Pattern;
import android.util.Log;
public class PythonUtil {
private static final String TAG = "PythonUtil";
private static final String TAG = "pythonutil";
protected static String[] getLibraries() {
return new String[] {
"SDL2",
"SDL2_image",
"SDL2_mixer",
"SDL2_ttf",
"python2.7",
"python3.5m",
"python3.6m",
"python3.7m",
"main"
};
protected static void addLibraryIfExists(ArrayList<String> libsList, String pattern, File libsDir) {
// pattern should be the name of the lib file, without the
// preceding "lib" or suffix ".so", for instance "ssl.*" will
// match files of the form "libssl.*.so".
File [] files = libsDir.listFiles();
pattern = "lib" + pattern + "\\.so";
Pattern p = Pattern.compile(pattern);
for (int i = 0; i < files.length; ++i) {
File file = files[i];
String name = file.getName();
Log.v(TAG, "Checking pattern " + pattern + " against " + name);
if (p.matcher(name).matches()) {
Log.v(TAG, "Pattern " + pattern + " matched file " + name);
libsList.add(name.substring(3, name.length() - 3));
}
}
}
public static void loadLibraries(File filesDir) {
protected static ArrayList<String> getLibraries(File libsDir) {
ArrayList<String> libsList = new ArrayList<String>();
libsList.add("python3.7m");
libsList.add("python3.8");
libsList.add("python3.9");
libsList.add("main");
return libsList;
}
String filesDirPath = filesDir.getAbsolutePath();
public static void loadLibraries(File filesDir, File libsDir) {
boolean foundPython = false;
for (String lib : getLibraries()) {
for (String lib : getLibraries(libsDir)) {
Log.v(TAG, "Loading library: " + lib);
try {
System.loadLibrary(lib);
if (lib.startsWith("python")) {
@ -37,25 +51,16 @@ public class PythonUtil {
// If this is the last possible libpython
// load, and it has failed, give a more
// general error
if (lib.startsWith("python3.7") && !foundPython) {
throw new java.lang.RuntimeException("Could not load any libpythonXXX.so");
}
Log.v(TAG, "Library loading error: " + e.getMessage());
if (lib.startsWith("python3.9") && !foundPython) {
throw new RuntimeException("Could not load any libpythonXXX.so");
} else if (lib.startsWith("python")) {
continue;
} else {
Log.v(TAG, "An UnsatisfiedLinkError occurred loading " + lib);
throw e;
}
}
try {
System.load(filesDirPath + "/lib/python2.7/lib-dynload/_io.so");
System.load(filesDirPath + "/lib/python2.7/lib-dynload/unicodedata.so");
} catch(UnsatisfiedLinkError e) {
Log.v(TAG, "Failed to load _io.so or unicodedata.so...but that's okay.");
}
try {
// System.loadLibrary("ctypes");
System.load(filesDirPath + "/lib/python2.7/lib-dynload/_ctypes.so");
} catch(UnsatisfiedLinkError e) {
Log.v(TAG, "Unsatisfied linker when loading ctypes");
}
Log.v(TAG, "Loaded everything!");

View file

@ -658,8 +658,8 @@ class BootstrapNDKRecipe(Recipe):
env['PYTHON_LINK_ROOT'] = self.ctx.python_recipe.link_root(arch.arch)
env['EXTRA_LDLIBS'] = ' -lpython{}'.format(
self.ctx.python_recipe.major_minor_version_string)
if 'python3' in self.ctx.python_recipe.name:
env['EXTRA_LDLIBS'] += 'm'
#if 'python3' in self.ctx.python_recipe.name:
# env['EXTRA_LDLIBS'] += 'm'
return env
@ -803,7 +803,7 @@ class PythonRecipe(Recipe):
'python'))
env['LDFLAGS'] += ' -L{}'.format(
join(ndk_dir_python, 'libs', arch.arch))
env['LDFLAGS'] += ' -lpython{}m'.format(python_short_version)
env['LDFLAGS'] += ' -lpython{}'.format(python_short_version)
hppath = []
hppath.append(join(dirname(self.hostpython_location), 'Lib'))

View file

@ -48,7 +48,7 @@ class CffiRecipe(CompiledComponentsPythonRecipe):
python_version = self.ctx.python_recipe.version[0:3]
ndk_dir_python = os.path.join(self.ctx.ndk_dir, 'sources/python/', python_version)
env['LDFLAGS'] += ' -L{}'.format(os.path.join(ndk_dir_python, 'libs', arch.arch))
env['LDFLAGS'] += ' -lpython{}m'.format(python_version)
env['LDFLAGS'] += ' -lpython{}'.format(python_version)
# until `pythonforandroid/archs.py` gets merged upstream:
# https://github.com/kivy/python-for-android/pull/1250/files#diff-569e13021e33ced8b54385f55b49cbe6
env['CFLAGS'] += ' -I{}/include/python/'.format(ndk_dir_python)

View file

@ -26,7 +26,7 @@ class CoincurveRecipe(CompiledComponentsPythonRecipe):
if self.ctx.ndk == 'crystax':
ndk_dir_python = os.path.join(self.ctx.ndk_dir, 'sources/python/', python_version)
env['LDFLAGS'] += ' -L{}'.format(os.path.join(ndk_dir_python, 'libs', arch.arch))
env['LDFLAGS'] += ' -lpython{}m'.format(python_version)
env['LDFLAGS'] += ' -lpython{}'.format(python_version)
# until `pythonforandroid/archs.py` gets merged upstream:
# https://github.com/kivy/python-for-android/pull/1250/files#diff-569e13021e33ced8b54385f55b49cbe6
env['CFLAGS'] += ' -I{}/include/python/'.format(ndk_dir_python)

View file

@ -6,7 +6,7 @@ class CryptographyRecipe(CompiledComponentsPythonRecipe):
name = 'cryptography'
version = '3.1.1'
url = 'https://github.com/pyca/cryptography/archive/{version}.tar.gz'
depends = [('python2', 'python3crystax'), 'openssl', 'idna', 'pyasn1', 'six', 'setuptools', 'ipaddress', 'cffi']
depends = [('python2', 'python3crystax'), 'openssl', 'six', 'setuptools', 'cffi']
call_hostpython_via_targetpython = False
patches = ['libpthread.patch']
@ -26,7 +26,7 @@ class CryptographyRecipe(CompiledComponentsPythonRecipe):
python_version = self.ctx.python_recipe.version[0:3]
ndk_dir_python = os.path.join(self.ctx.ndk_dir, 'sources/python/', python_version)
env['LDFLAGS'] += ' -L{}'.format(os.path.join(ndk_dir_python, 'libs', arch.arch))
env['LDFLAGS'] += ' -lpython{}m'.format(python_version)
env['LDFLAGS'] += ' -lpython{}'.format(python_version)
# until `pythonforandroid/archs.py` gets merged upstream:
# https://github.com/kivy/python-for-android/pull/1250/files#diff-569e13021e33ced8b54385f55b49cbe6
env['CFLAGS'] += ' -I{}/include/python/'.format(ndk_dir_python) + ' -L{}'.format(os.path.join(ndk_dir_python, 'libs', arch.arch))

View file

@ -23,7 +23,7 @@ class NetifacesRecipe(CompiledComponentsPythonRecipe):
python_version = self.ctx.python_recipe.version[0:3]
ndk_dir_python = os.path.join(self.ctx.ndk_dir, 'sources/python/', python_version)
env['LDFLAGS'] += ' -L{}'.format(os.path.join(ndk_dir_python, 'libs', arch.arch))
env['LDFLAGS'] += ' -lpython{}m'.format(python_version)
env['LDFLAGS'] += ' -lpython{}'.format(python_version)
# until `pythonforandroid/archs.py` gets merged upstream:
# https://github.com/kivy/python-for-android/pull/1250/files#diff-569e13021e33ced8b54385f55b49cbe6
env['CFLAGS'] += ' -I{}/include/python/'.format(ndk_dir_python)

View file

@ -6,9 +6,7 @@ from os.path import join
class PyjniusRecipe(CythonRecipe):
# "6553ad4" is one commit after last release (1.2.0)
# it fixes method resolution, required for resolving requestPermissions()
version = '6553ad4'
version = '1.3.0'
url = 'https://github.com/kivy/pyjnius/archive/{version}.zip'
name = 'pyjnius'
depends = [('genericndkbuild', 'sdl2', 'sdl'), 'six']

View file

@ -10,16 +10,16 @@ index ac89fec..71daa43 100644
cdef JNIEnv *get_platform_jnienv():
- return SDL_ANDROID_GetJNIEnv()
+ return <JNIEnv*>WebView_AndroidGetJNIEnv()
diff --git a/setup.py b/setup.py
index 740510f..0c8e55f 100644
--- a/setup.py
+++ b/setup.py
@@ -53,7 +53,7 @@ except ImportError:
diff --git a/jnius/env.py b/jnius/env.py
--- a/jnius/env.py
+++ b/jnius/env.py
@@ -185,10 +185,10 @@ except ImportError:
if PLATFORM == 'android':
def get_libraries(platform):
if platform == 'android':
# for android, we use SDL...
- LIBRARIES = ['sdl', 'log']
+ LIBRARIES = ['main', 'log']
LIBRARY_DIRS = ['libs/' + getenv('ARCH')]
elif PLATFORM == 'darwin':
import subprocess
- return ['sdl', 'log']
+ return ['main', 'log']
elif platform == 'win32':
return ['jvm']

View file

@ -10,16 +10,17 @@ index ac89fec..71daa43 100644
cdef JNIEnv *get_platform_jnienv():
- return SDL_ANDROID_GetJNIEnv()
+ return <JNIEnv*>SDL_AndroidGetJNIEnv()
diff --git a/setup.py b/setup.py
diff --git a/env.py b/env.py
index 740510f..0c8e55f 100644
--- a/setup.py
+++ b/setup.py
@@ -53,7 +53,7 @@ except ImportError:
--- a/jnius/env.py
+++ b/jnius/env.py
@@ -185,10 +185,10 @@ except ImportError:
if PLATFORM == 'android':
def get_libraries(platform):
if platform == 'android':
# for android, we use SDL...
- LIBRARIES = ['sdl', 'log']
+ LIBRARIES = ['SDL2', 'log']
LIBRARY_DIRS = ['libs/' + getenv('ARCH')]
elif PLATFORM == 'darwin':
import subprocess
- return ['sdl', 'log']
+ return ['SDL2', 'log']
elif platform == 'win32':
return ['jvm']

View file

@ -33,7 +33,8 @@ OPENSSLCONF = """#if defined(__ARM_ARCH_5TE__)
LATEST_FULL_VERSION = {
'3.5': '3.5.1',
'3.6': '3.6.6',
'3.7': '3.7.1'
'3.7': '3.7.1',
'3.9': '3.9.6'
}
def realpath(fname):
@ -61,7 +62,7 @@ def realpath(fname):
return os.sep.join(abs_path)
class Python3Recipe(TargetPythonRecipe):
version = '3.7'
version = '3.9'
url = ''
name = 'python3crystax'
@ -71,7 +72,7 @@ class Python3Recipe(TargetPythonRecipe):
from_crystax = True
def download_if_necessary(self):
if 'openssl' in self.ctx.recipe_build_order or self.version == '3.6' or self.version == '3.7':
if 'openssl' in self.ctx.recipe_build_order or self.version == '3.6' or self.version == '3.7' or self.version == '3.9':
full_version = LATEST_FULL_VERSION[self.version]
Python3Recipe.url = 'https://www.python.org/ftp/python/{0}.{1}.{2}/Python-{0}.{1}.{2}.tgz'.format(*full_version.split('.'))
super(Python3Recipe, self).download_if_necessary()
@ -168,8 +169,29 @@ class Python3Recipe(TargetPythonRecipe):
def prebuild_arch(self, arch):
super(Python3Recipe, self).prebuild_arch(arch)
if self.version == '3.6' or self.version == '3.7':
Python3Recipe.patches = ['patch_python3.6.patch', 'remove_android_api_check.patch', 'selectors.patch']
if self.version == '3.6' or self.version == '3.7' or self.version == '3.9':
Python3Recipe.patches = [
'patch/patch_python3.6.patch',
'patch/remove_android_api_check.patch',
'patch/selectors.patch'
]
if self.version == '3.9':
Python3Recipe.patches = [
'patch/remove_android_api_check.patch',
'patch/patch_python3.9.patch',
'patch/platlibdir.patch',
'patch/strdup.patch',
# from https://github.com/kivy/python-for-android/blob/develop/pythonforandroid/recipes/python3/__init__.py#L63
'patch/pyconfig_detection.patch',
'patch/reproducible-buildinfo.diff',
'patch/py3.8.1.patch'
]
if sh.which('lld') is not None:
Python3Recipe.patches += ['patch/py3.8.1_fix_cortex_a8.patch']
build_dir = self.get_build_dir(arch.arch)
# copy bundled libffi to _ctypes
@ -183,14 +205,18 @@ class Python3Recipe(TargetPythonRecipe):
python_build_files = ['android.mk', 'config.c', 'interpreter.c']
ndk_build_tools_python_dir = join(self.ctx.ndk_dir, 'build', 'tools', 'build-target-python')
for python_build_file in python_build_files:
shprint(sh.cp, join(self.get_recipe_dir(), python_build_file+'.3.7'),
join(ndk_build_tools_python_dir, python_build_file+'.3.7'))
shprint(sh.cp, join(self.get_recipe_dir(), python_build_file+'.3.9'),
join(ndk_build_tools_python_dir, python_build_file+'.3.9'))
ndk_sources_python_dir = join(self.ctx.ndk_dir, 'sources', 'python')
if not os.path.exists(join(ndk_sources_python_dir, '3.7')):
os.mkdir(join(ndk_sources_python_dir, '3.7'))
sh.sed('s#3.5#3.7#',
if not os.path.exists(join(ndk_sources_python_dir, '3.9')):
os.mkdir(join(ndk_sources_python_dir, '3.9'))
sh.sed('s#3.5#3.9#',
join(ndk_sources_python_dir, '3.5/Android.mk'),
_out=join(ndk_sources_python_dir, '3.7/Android.mk'))
_out=join(ndk_sources_python_dir, '3.9/Android.mk.tmp'))
sh.sed('s#3.9m#3.9#',
join(ndk_sources_python_dir, '3.9/Android.mk.tmp'),
_out=join(ndk_sources_python_dir, '3.9/Android.mk'))
shprint(sh.rm, '-f', join(ndk_sources_python_dir, '3.9/Android.mk.tmp'))
def build_arch(self, arch):
# If openssl is needed we may have to recompile cPython to get the

View file

@ -27,14 +27,17 @@ LOCAL_SRC_FILES := config.c \
$(MY_PYTHON_SRC_ROOT)/Python/getversion.c \
$(MY_PYTHON_SRC_ROOT)/Python/graminit.c \
$(MY_PYTHON_SRC_ROOT)/Python/hamt.c \
$(MY_PYTHON_SRC_ROOT)/Python/hashtable.c \
$(MY_PYTHON_SRC_ROOT)/Python/import.c \
$(MY_PYTHON_SRC_ROOT)/Python/importdl.c \
$(MY_PYTHON_SRC_ROOT)/Python/initconfig.c \
$(MY_PYTHON_SRC_ROOT)/Python/marshal.c \
$(MY_PYTHON_SRC_ROOT)/Python/modsupport.c \
$(MY_PYTHON_SRC_ROOT)/Python/mysnprintf.c \
$(MY_PYTHON_SRC_ROOT)/Python/mystrtoul.c \
$(MY_PYTHON_SRC_ROOT)/Python/pathconfig.c \
$(MY_PYTHON_SRC_ROOT)/Python/peephole.c \
$(MY_PYTHON_SRC_ROOT)/Python/preconfig.c \
$(MY_PYTHON_SRC_ROOT)/Python/pyarena.c \
$(MY_PYTHON_SRC_ROOT)/Python/pyctype.c \
$(MY_PYTHON_SRC_ROOT)/Python/pyfpe.c \
@ -57,17 +60,18 @@ LOCAL_SRC_FILES := config.c \
$(MY_PYTHON_SRC_ROOT)/Python/_warnings.c \
\
$(MY_PYTHON_SRC_ROOT)/Parser/acceler.c \
$(MY_PYTHON_SRC_ROOT)/Parser/bitset.c \
$(MY_PYTHON_SRC_ROOT)/Parser/firstsets.c \
$(MY_PYTHON_SRC_ROOT)/Parser/grammar.c \
$(MY_PYTHON_SRC_ROOT)/Parser/grammar1.c \
$(MY_PYTHON_SRC_ROOT)/Parser/listnode.c \
$(MY_PYTHON_SRC_ROOT)/Parser/metagrammar.c \
$(MY_PYTHON_SRC_ROOT)/Parser/myreadline.c \
$(MY_PYTHON_SRC_ROOT)/Parser/node.c \
$(MY_PYTHON_SRC_ROOT)/Parser/parser.c \
$(MY_PYTHON_SRC_ROOT)/Parser/parsetok.c \
$(MY_PYTHON_SRC_ROOT)/Parser/token.c \
$(MY_PYTHON_SRC_ROOT)/Parser/tokenizer.c \
$(MY_PYTHON_SRC_ROOT)/Parser/pegen/parse.c \
$(MY_PYTHON_SRC_ROOT)/Parser/pegen/parse_string.c \
$(MY_PYTHON_SRC_ROOT)/Parser/pegen/peg_api.c \
$(MY_PYTHON_SRC_ROOT)/Parser/pegen/pegen.c \
\
$(MY_PYTHON_SRC_ROOT)/Objects/abstract.c \
$(MY_PYTHON_SRC_ROOT)/Objects/accu.c \
@ -90,6 +94,8 @@ LOCAL_SRC_FILES := config.c \
$(MY_PYTHON_SRC_ROOT)/Objects/frameobject.c \
$(MY_PYTHON_SRC_ROOT)/Objects/funcobject.c \
$(MY_PYTHON_SRC_ROOT)/Objects/genobject.c \
$(MY_PYTHON_SRC_ROOT)/Objects/genericaliasobject.c \
$(MY_PYTHON_SRC_ROOT)/Objects/interpreteridobject.c \
$(MY_PYTHON_SRC_ROOT)/Objects/iterobject.c \
$(MY_PYTHON_SRC_ROOT)/Objects/listobject.c \
$(MY_PYTHON_SRC_ROOT)/Objects/longobject.c \
@ -100,6 +106,7 @@ LOCAL_SRC_FILES := config.c \
$(MY_PYTHON_SRC_ROOT)/Objects/object.c \
$(MY_PYTHON_SRC_ROOT)/Objects/obmalloc.c \
$(MY_PYTHON_SRC_ROOT)/Objects/odictobject.c \
$(MY_PYTHON_SRC_ROOT)/Objects/picklebufobject.c \
$(MY_PYTHON_SRC_ROOT)/Objects/rangeobject.c \
$(MY_PYTHON_SRC_ROOT)/Objects/setobject.c \
$(MY_PYTHON_SRC_ROOT)/Objects/sliceobject.c \
@ -131,10 +138,8 @@ LOCAL_SRC_FILES := config.c \
$(MY_PYTHON_SRC_ROOT)/Modules/gcmodule.c \
$(MY_PYTHON_SRC_ROOT)/Modules/getbuildinfo.c \
$(MY_PYTHON_SRC_ROOT)/Modules/getpath.c \
$(MY_PYTHON_SRC_ROOT)/Modules/hashtable.c \
$(MY_PYTHON_SRC_ROOT)/Modules/_heapqmodule.c \
$(MY_PYTHON_SRC_ROOT)/Modules/itertoolsmodule.c \
$(MY_PYTHON_SRC_ROOT)/Modules/_json.c \
$(MY_PYTHON_SRC_ROOT)/Modules/_localemodule.c \
$(MY_PYTHON_SRC_ROOT)/Modules/_lsprof.c \
$(MY_PYTHON_SRC_ROOT)/Modules/main.c \
@ -146,7 +151,6 @@ LOCAL_SRC_FILES := config.c \
$(MY_PYTHON_SRC_ROOT)/Modules/_operator.c \
$(MY_PYTHON_SRC_ROOT)/Modules/ossaudiodev.c \
$(MY_PYTHON_SRC_ROOT)/Modules/parsermodule.c \
$(MY_PYTHON_SRC_ROOT)/Modules/_pickle.c \
$(MY_PYTHON_SRC_ROOT)/Modules/posixmodule.c \
$(MY_PYTHON_SRC_ROOT)/Modules/_posixsubprocess.c \
$(MY_PYTHON_SRC_ROOT)/Modules/pwdmodule.c \
@ -176,7 +180,6 @@ LOCAL_SRC_FILES := config.c \
$(MY_PYTHON_SRC_ROOT)/Modules/xxlimited.c \
$(MY_PYTHON_SRC_ROOT)/Modules/xxmodule.c \
$(MY_PYTHON_SRC_ROOT)/Modules/xxsubtype.c \
$(MY_PYTHON_SRC_ROOT)/Modules/zipimport.c \
$(MY_PYTHON_SRC_ROOT)/Modules/zlibmodule.c \
$(MY_PYTHON_SRC_ROOT)/Modules/cjkcodecs/_codecs_cn.c \
$(MY_PYTHON_SRC_ROOT)/Modules/cjkcodecs/_codecs_hk.c \

View file

@ -26,7 +26,6 @@ extern PyObject* PyInit__thread(void);
extern PyObject* PyInit__codecs(void);
extern PyObject* PyInit__weakref(void);
extern PyObject* PyInit_xxsubtype(void);
extern PyObject* PyInit_zipimport(void);
extern PyObject* PyInit__random(void);
extern PyObject* PyInit_itertools(void);
extern PyObject* PyInit__collections(void);
@ -40,7 +39,6 @@ extern PyObject* PyInit_parser(void);
extern PyObject* PyInit__struct(void);
extern PyObject* PyInit__datetime(void);
extern PyObject* PyInit__functools(void);
extern PyObject* PyInit__json(void);
extern PyObject* PyInit_zlib(void);
extern PyObject* PyInit__multibytecodec(void);
extern PyObject* PyInit__codecs_cn(void);
@ -53,7 +51,6 @@ extern PyObject* PyInit__winapi(void);
extern PyObject* PyInit__lsprof(void);
extern PyObject* PyInit__ast(void);
extern PyObject* PyInit__io(void);
extern PyObject* PyInit__pickle(void);
extern PyObject* PyInit_atexit(void);
extern PyObject* _PyWarnings_Init(void);
extern PyObject* PyInit__string(void);
@ -103,10 +100,8 @@ struct _inittab _PyImport_Inittab[] = {
{"_struct", PyInit__struct},
{"_datetime", PyInit__datetime},
{"_functools", PyInit__functools},
{"_json", PyInit__json},
{"xxsubtype", PyInit_xxsubtype},
{"zipimport", PyInit_zipimport},
{"zlib", PyInit_zlib},
/* CJK codecs */
@ -131,7 +126,6 @@ struct _inittab _PyImport_Inittab[] = {
{"_string", PyInit__string},
{"_io", PyInit__io},
{"_pickle", PyInit__pickle},
{"atexit", PyInit_atexit},
{"_stat", PyInit__stat},
{"_opcode", PyInit__opcode},

View file

@ -9,7 +9,7 @@
#define PYTHON3_STDLIB_REL_PATH "stdlib.zip"
#define PYTHON3_MODULES_REL_PATH "modules"
#define PYTHON3_DLL_REL_PATH "libpython3.7m.so"
#define PYTHON3_DLL_REL_PATH "libpython3.9.so"
#define SYS_PATH_BUFFER_SIZE (2*(PATH_MAX + 1))

View file

@ -0,0 +1,93 @@
--- a/Modules/expat/xmlparse.c 2021-06-28 09:26:18.000000000 +0100
+++ b/Modules/expat/xmlparse.c 2021-08-20 10:19:38.946990574 +0100
@@ -89,6 +89,8 @@
# define LOAD_LIBRARY_SEARCH_SYSTEM32 0x00000800
#endif
+#define XML_POOR_ENTROPY 1
+
#if ! defined(HAVE_GETRANDOM) && ! defined(HAVE_SYSCALL_GETRANDOM) \
&& ! defined(HAVE_ARC4RANDOM_BUF) && ! defined(HAVE_ARC4RANDOM) \
&& ! defined(XML_DEV_URANDOM) && ! defined(_WIN32)
diff --git a/Modules/getpath.c b/Modules/getpath.c
--- a/Modules/getpath.c 2021-06-28 09:26:18.000000000 +0100
+++ b/Modules/getpath.c 2021-08-20 10:29:27.000481395 +0100
@@ -103,10 +103,39 @@
extern "C" {
#endif
+/*
+ These variables were set this way in older versions of Python, but
+ changed from 3.5.1 to 3.5.2.
+ https://github.com/python/cpython/commit/f5854148138280c69fdc9d350636dc2140d57753
+ Here we just the old way again. A better solution would be to work
+ out where they should be defined, and make the CrystaX build scripts do so.
+*/
-#if (!defined(PREFIX) || !defined(EXEC_PREFIX) \
- || !defined(VERSION) || !defined(VPATH))
-#error "PREFIX, EXEC_PREFIX, VERSION and VPATH macros must be defined"
+/*
+ * #if (!defined(PREFIX) || !defined(EXEC_PREFIX) \
+ * || !defined(VERSION) || !defined(VPATH))
+ * #error "PREFIX, EXEC_PREFIX, VERSION and VPATH macros must be defined"
+ * #endif
+ */
+#ifndef VERSION
+#define VERSION "2.1"
+#endif
+
+#ifndef VPATH
+#define VPATH "."
+#endif
+
+#ifndef PREFIX
+# define PREFIX "/usr/local"
+#endif
+
+#ifndef EXEC_PREFIX
+#define EXEC_PREFIX PREFIX
+#endif
+
+#ifndef PYTHONPATH
+#define PYTHONPATH PREFIX "/lib/python" VERSION ":" \
+ EXEC_PREFIX "/lib/python" VERSION "/lib-dynload"
#endif
#ifndef LANDMARK
diff --git a/Modules/timemodule.c b/Modules/timemodule.c
--- a/Modules/timemodule.c
+++ b/Modules/timemodule.c
@@ -358,18 +358,20 @@ time_gmtime(PyObject *self, PyObject *args)
#endif
}
-#ifndef HAVE_TIMEGM
-static time_t
-timegm(struct tm *p)
-{
- /* XXX: the following implementation will not work for tm_year < 1970.
- but it is likely that platforms that don't have timegm do not support
- negative timestamps anyways. */
- return p->tm_sec + p->tm_min*60 + p->tm_hour*3600 + p->tm_yday*86400 +
- (p->tm_year-70)*31536000 + ((p->tm_year-69)/4)*86400 -
- ((p->tm_year-1)/100)*86400 + ((p->tm_year+299)/400)*86400;
-}
-#endif
+/* In the Android build, HAVE_TIMEGM apparently should be defined but isn't. A better fix would be to work out why and fix that. */
+
+/* #ifndef HAVE_TIMEGM */
+/* static time_t */
+/* timegm(struct tm *p) */
+/* { */
+/* /\* XXX: the following implementation will not work for tm_year < 1970. */
+/* but it is likely that platforms that don't have timegm do not support */
+/* negative timestamps anyways. *\/ */
+/* return p->tm_sec + p->tm_min*60 + p->tm_hour*3600 + p->tm_yday*86400 + */
+/* (p->tm_year-70)*31536000 + ((p->tm_year-69)/4)*86400 - */
+/* ((p->tm_year-1)/100)*86400 + ((p->tm_year+299)/400)*86400; */
+/* } */
+/* #endif */
PyDoc_STRVAR(gmtime_doc,
"gmtime([seconds]) -> (tm_year, tm_mon, tm_mday, tm_hour, tm_min,\n\

View file

@ -0,0 +1,11 @@
--- a/Python/initconfig.c 2021-06-28 09:26:18.000000000 +0100
+++ b/Python/initconfig.c 2021-08-20 12:03:57.319576456 +0100
@@ -25,7 +25,7 @@
#endif
#ifndef PLATLIBDIR
-# error "PLATLIBDIR macro must be defined"
+# define PLATLIBDIR "/usr/lib"
#endif

View file

@ -0,0 +1,42 @@
diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py
index 97973bc..053c231 100644
--- a/Lib/ctypes/util.py
+++ b/Lib/ctypes/util.py
@@ -67,6 +67,13 @@ if os.name == "nt":
return fname
return None
+# This patch overrides the find_library to look in the right places on
+# Android
+if True:
+ from android._ctypes_library_finder import find_library as _find_lib
+ def find_library(name):
+ return _find_lib(name)
+
elif os.name == "posix" and sys.platform == "darwin":
from ctypes.macholib.dyld import dyld_find as _dyld_find
def find_library(name):
diff --git a/configure b/configure
index 0914e24..dd00812 100755
--- a/configure
+++ b/configure
@@ -18673,4 +18673,3 @@ if test "$Py_OPT" = 'false' -a "$Py_DEBUG" != 'true'; then
echo "" >&6
echo "" >&6
fi
-
diff --git a/setup.py b/setup.py
index 20d7f35..af15cc2 100644
--- a/setup.py
+++ b/setup.py
@@ -1501,7 +1501,9 @@ class PyBuildExt(build_ext):
if zlib_inc is not None:
zlib_h = zlib_inc[0] + '/zlib.h'
version = '"0.0.0"'
- version_req = '"1.1.3"'
+ # version_req = '"1.1.3"'
+ version_req = '"{}"'.format(
+ os.environ.get('ZLIB_VERSION', '1.1.3'))
if MACOS and is_macosx_sdk_path(zlib_h):
zlib_h = os.path.join(macosx_sdk_root(), zlib_h[1:])
with open(zlib_h) as fp:

View file

@ -0,0 +1,15 @@
This patch removes --fix-cortex-a8 from the linker flags in order to support linking
with lld, as lld does not support this flag (https://github.com/android-ndk/ndk/issues/766).
diff --git a/configure b/configure
index 0914e24..7517168 100755
--- a/configure
+++ b/configure
@@ -5642,7 +5642,7 @@ $as_echo_n "checking for the Android arm ABI... " >&6; }
$as_echo "$_arm_arch" >&6; }
if test "$_arm_arch" = 7; then
BASECFLAGS="${BASECFLAGS} -mfloat-abi=softfp -mfpu=vfpv3-d16"
- LDFLAGS="${LDFLAGS} -march=armv7-a -Wl,--fix-cortex-a8"
+ LDFLAGS="${LDFLAGS} -march=armv7-a"
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not Android" >&5

View file

@ -0,0 +1,13 @@
diff -Nru Python-3.8.2/Lib/site.py Python-3.8.2-new/Lib/site.py
--- Python-3.8.2/Lib/site.py 2020-04-28 12:48:38.000000000 -0700
+++ Python-3.8.2-new/Lib/site.py 2020-04-28 12:52:46.000000000 -0700
@@ -487,7 +487,8 @@
if key == 'include-system-site-packages':
system_site = value.lower()
elif key == 'home':
- sys._home = value
+ # this is breaking pyconfig.h path detection with venv
+ print('Ignoring "sys._home = value" override')
sys.prefix = sys.exec_prefix = site_prefix

View file

@ -0,0 +1,13 @@
# DP: Build getbuildinfo.o with DATE/TIME values when defined
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -785,6 +785,8 @@ Modules/getbuildinfo.o: $(PARSER_OBJS) \
-DGITVERSION="\"`LC_ALL=C $(GITVERSION)`\"" \
-DGITTAG="\"`LC_ALL=C $(GITTAG)`\"" \
-DGITBRANCH="\"`LC_ALL=C $(GITBRANCH)`\"" \
+ $(if $(BUILD_DATE),-DDATE='"$(BUILD_DATE)"') \
+ $(if $(BUILD_TIME),-DTIME='"$(BUILD_TIME)"') \
-o $@ $(srcdir)/Modules/getbuildinfo.c
Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile

View file

@ -0,0 +1,10 @@
--- a/Python/strdup.c 2021-06-28 09:26:18.000000000 +0100
+++ b/Python/strdup.c 2021-08-20 09:26:36.443055850 +0100
@@ -1,5 +1,7 @@
/* strdup() replacement (from stdwin, if you must know) */
+#include "Python.h"
+
char *
strdup(const char *str)
{

View file

@ -2,7 +2,7 @@ from pythonforandroid.recipe import PythonRecipe
class SetuptoolsRecipe(PythonRecipe):
version = '40.0.0'
version = '51.0.0'
url = 'https://pypi.python.org/packages/source/s/setuptools/setuptools-{version}.zip'
depends = [('python2', 'python3crystax')]

View file

@ -350,7 +350,11 @@ build_python_for_abi ()
echo " --with-threads \\"
echo " --enable-ipv6 \\"
echo " --with-computed-gotos \\"
echo " --without-ensurepip"
echo " ac_cv_file__dev_ptmx=yes \\"
echo " ac_cv_file__dev_ptc=no \\"
echo " --without-ensurepip \\"
echo " ac_cv_little_endian_double=yes \\"
echo " --exec-prefix=/usr/local"
fi
} >$CONFIGURE_WRAPPER
fail_panic "Can't create configure wrapper"
@ -382,8 +386,8 @@ build_python_for_abi ()
if [ "$PYTHON_MAJOR_VERSION" = "2" ]; then
local PYTHON_CORE_MODULE_NAME='python'"$PYTHON_ABI"
else
local PYTHON_CORE_MODULE_NAME='python'"$PYTHON_ABI"'m'
local PYTHON_SOABI='cpython-'"$PYTHON_ABI"'m'
local PYTHON_CORE_MODULE_NAME='python'"$PYTHON_ABI"
local PYTHON_SOABI='cpython-'"$PYTHON_ABI"
fi
{
echo 'LOCAL_PATH := $(call my-dir)'
@ -391,6 +395,8 @@ build_python_for_abi ()
echo "LOCAL_MODULE := $PYTHON_CORE_MODULE_NAME"
echo "MY_PYTHON_SRC_ROOT := $PYTHON_SRCDIR"
echo 'LOCAL_C_INCLUDES := $(MY_PYTHON_SRC_ROOT)/Include'
echo 'LOCAL_C_INCLUDES += $(MY_PYTHON_SRC_ROOT)/Include/internal'
echo 'LOCAL_C_INCLUDES += $(MY_PYTHON_SRC_ROOT)/Include/cpython'
if [ "$PYTHON_MAJOR_VERSION" = "2" ]; then
echo "LOCAL_CFLAGS := -DPy_BUILD_CORE -DPy_ENABLE_SHARED -DPLATFORM=\\\"linux\\\""
else
@ -410,6 +416,8 @@ build_python_for_abi ()
run rm -Rf $PYTHON_DSTDIR/include
run mkdir -p $PYTHON_DSTDIR/include/python && \
run cp -p $PYTHON_BUILD_UTILS_DIR/pyconfig.h $PYTHON_SRCDIR/Include/*.h $PYTHON_DSTDIR/include/python
run cp -pR $PYTHON_SRCDIR/Include/internal $PYTHON_DSTDIR/include/python/internal
run cp -pR $PYTHON_SRCDIR/Include/cpython $PYTHON_DSTDIR/include/python/cpython
fail_panic "Can't install python$PYTHON_ABI headers"
PYTHON_HEADERS_INSTALLED=yes
export PYTHON_HEADERS_INSTALLED
@ -542,9 +550,11 @@ build_python_for_abi ()
{
echo 'LOCAL_PATH := $(call my-dir)'
echo 'include $(CLEAR_VARS)'
echo 'LOCAL_MODULE := _ctypes'
echo 'LOCAL_C_INCLUDES := $(LOCAL_PATH)/include'
echo "MY_PYTHON_SRC_ROOT := $PYTHON_SRCDIR"
echo 'LOCAL_MODULE := _ctypes'
echo 'LOCAL_CFLAGS := -DPy_BUILD_CORE'
echo 'LOCAL_C_INCLUDES := $(LOCAL_PATH)/include'
echo 'LOCAL_C_INCLUDES += $(MY_PYTHON_SRC_ROOT)/Include/internal'
echo 'LOCAL_SRC_FILES := \'
for ffi_src in $FFI_SRC_LIST; do
echo " \$(MY_PYTHON_SRC_ROOT)/Modules/_ctypes/libffi/$ffi_src \\"
@ -640,6 +650,7 @@ build_python_for_abi ()
echo "MY_PYTHON_SRC_ROOT := $PYTHON_SRCDIR"
echo 'LOCAL_SRC_FILES := \'
echo ' $(MY_PYTHON_SRC_ROOT)/Modules/_queuemodule.c'
echo 'LOCAL_C_INCLUDES := $(MY_PYTHON_SRC_ROOT)/Include/internal'
echo 'LOCAL_STATIC_LIBRARIES := python_shared'
echo 'include $(BUILD_SHARED_LIBRARY)'
echo "\$(call import-module,python/$PYTHON_ABI)"
@ -665,6 +676,8 @@ build_python_for_abi ()
echo 'include $(CLEAR_VARS)'
echo 'LOCAL_MODULE := _asyncio'
echo "MY_PYTHON_SRC_ROOT := $PYTHON_SRCDIR"
echo 'LOCAL_CFLAGS := -DPy_BUILD_CORE'
echo 'LOCAL_C_INCLUDES := $(MY_PYTHON_SRC_ROOT)/Include/internal'
echo 'LOCAL_SRC_FILES := \'
echo ' $(MY_PYTHON_SRC_ROOT)/Modules/_asynciomodule.c'
echo 'LOCAL_STATIC_LIBRARIES := python_shared'
@ -879,7 +892,7 @@ build_python_for_abi ()
echo 'LOCAL_MODULE := pyexpat'
echo 'LOCAL_CFLAGS := -DHAVE_EXPAT_CONFIG_H -DXML_STATIC'
echo "MY_PYTHON_SRC_ROOT := $PYTHON_SRCDIR"
echo "LOCAL_C_INCLUDES := \$(MY_PYTHON_SRC_ROOT)/Modules/expat"
echo 'LOCAL_C_INCLUDES := \$(MY_PYTHON_SRC_ROOT)/Modules/expat'
echo 'LOCAL_SRC_FILES := \'
echo ' $(MY_PYTHON_SRC_ROOT)/Modules/expat/xmlparse.c \'
echo ' $(MY_PYTHON_SRC_ROOT)/Modules/expat/xmlrole.c \'
@ -951,6 +964,64 @@ build_python_for_abi ()
log "Install python$PYTHON_ABI-$ABI module 'unicodedata' in $PYBIN_INSTALLDIR_MODULES"
run cp -p -T $OBJDIR_UNICODEDATA/libunicodedata.so $PYBIN_INSTALLDIR_MODULES/unicodedata.so
fail_panic "Can't install python$PYTHON_ABI-$ABI module 'unicodedata' in $PYBIN_INSTALLDIR_MODULES"
# _json speedups
local BUILDDIR_JSON="$BUILDDIR/json"
local OBJDIR_JSON="$BUILDDIR_JSON/obj/local/$ABI"
run mkdir -p "$BUILDDIR_JSON/jni"
fail_panic "Can't create directory: $BUILDDIR_JSON/jni"
{
echo 'LOCAL_PATH := $(call my-dir)'
echo 'include $(CLEAR_VARS)'
echo 'LOCAL_MODULE := _json'
echo "MY_PYTHON_SRC_ROOT := $PYTHON_SRCDIR"
echo 'LOCAL_C_INCLUDES := $(MY_PYTHON_SRC_ROOT)/Include/internal'
echo 'LOCAL_SRC_FILES := \'
echo ' $(MY_PYTHON_SRC_ROOT)/Modules/_json.c'
echo 'LOCAL_STATIC_LIBRARIES := python_shared'
echo 'LOCAL_CFLAGS := -DPy_BUILD_CORE_MODULE'
echo 'include $(BUILD_SHARED_LIBRARY)'
echo "\$(call import-module,python/$PYTHON_ABI)"
} >$BUILDDIR_JSON/jni/Android.mk
fail_panic "Can't generate $BUILDDIR_JSON/jni/Android.mk"
run $NDK_DIR/ndk-build -C $BUILDDIR_JSON -j$NUM_JOBS APP_ABI=$ABI V=1
fail_panic "Can't build python$PYTHON_ABI-$ABI module '_json'"
log "Install python$PYTHON_ABI-$ABI module '_json' in $PYBIN_INSTALLDIR_MODULES"
run cp -p -T $OBJDIR_JSON/lib_json.so $PYBIN_INSTALLDIR_MODULES/_json.so
fail_panic "Can't install python$PYTHON_ABI-$ABI module '_json' in $PYBIN_INSTALLDIR_MODULES"
# _pickle accelerator
local BUILDDIR_PICKLE="$BUILDDIR/pickle"
local OBJDIR_PICKLE="$BUILDDIR_PICKLE/obj/local/$ABI"
run mkdir -p "$BUILDDIR_PICKLE/jni"
fail_panic "Can't create directory: $BUILDDIR_PICKLE/jni"
{
echo 'LOCAL_PATH := $(call my-dir)'
echo 'include $(CLEAR_VARS)'
echo 'LOCAL_MODULE := _pickle'
echo "MY_PYTHON_SRC_ROOT := $PYTHON_SRCDIR"
echo 'LOCAL_C_INCLUDES := $(MY_PYTHON_SRC_ROOT)/Include/internal'
echo 'LOCAL_SRC_FILES := \'
echo ' $(MY_PYTHON_SRC_ROOT)/Modules/_pickle.c'
echo 'LOCAL_STATIC_LIBRARIES := python_shared'
echo 'LOCAL_CFLAGS := -DPy_BUILD_CORE_MODULE'
echo 'include $(BUILD_SHARED_LIBRARY)'
echo "\$(call import-module,python/$PYTHON_ABI)"
} >$BUILDDIR_PICKLE/jni/Android.mk
fail_panic "Can't generate $BUILDDIR_PICKLE/jni/Android.mk"
run $NDK_DIR/ndk-build -C $BUILDDIR_PICKLE -j$NUM_JOBS APP_ABI=$ABI V=1
fail_panic "Can't build python$PYTHON_ABI-$ABI module '_pickle'"
log "Install python$PYTHON_ABI-$ABI module '_pickle' in $PYBIN_INSTALLDIR_MODULES"
run cp -p -T $OBJDIR_PICKLE/lib_pickle.so $PYBIN_INSTALLDIR_MODULES/_pickle.so
fail_panic "Can't install python$PYTHON_ABI-$ABI module '_pickle' in $PYBIN_INSTALLDIR_MODULES"
}
if [ -n "$PACKAGE_DIR" ]; then