Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CORE UPDATE - PART I] Refactor python recipes + openssl + sqlite3 #1537

Merged
merged 66 commits into from
Jan 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
ecae875
Refactor hostpython3's recipe into a new base class HostPythonRecipe
opacam Dec 4, 2018
dd2b402
Refactor python3's recipe into a new base class GuestPythonRecipe
opacam Dec 4, 2018
883849e
Move hostpython2 and python2 recipes to a new name hostpython2legacy …
opacam Dec 4, 2018
4c487fd
Add the new hostpython2/python2 recipes (v2.7.15)
opacam Dec 4, 2018
e85969e
Adapt sdl2's stuff to the new python2's build system
opacam Dec 4, 2018
9fb72b0
Adapt pythonforandroid's core files to the new python2's build system
opacam Dec 4, 2018
c642482
Adapt python2's test apps to the new python2's build system
opacam Dec 4, 2018
fd99a30
Enable sqlite support for python recipes
opacam Dec 4, 2018
71ba0fb
Add ability to compile recipes with clang
tito Nov 25, 2018
6cb1b20
Update OpenSSL to 1.1.1 (uses clang for compilation)
tito Nov 25, 2018
f716a3a
Enhance openssl recipe and remove lib_version
opacam Nov 25, 2018
de6808f
Enable openssl support for python recipes
opacam Dec 4, 2018
bc91696
Fix hardcoded python2 entry for Arch
opacam Nov 25, 2018
1c365d9
Fix hardcoded python2 entries for BootstrapNDKRecipes
opacam Nov 25, 2018
f67c8f8
Fix duplicated key in options for python2 test
opacam Nov 25, 2018
e11c4d1
Fix numpy's recipe and adds python3's compatibility.
opacam Dec 4, 2018
6b60c62
Add python3 test for sqlite and openssl and add python3's compatibili…
opacam Nov 25, 2018
56cb4cc
Make that travis test python3 with sqlite3 and openssl
opacam Dec 18, 2018
c8f7d0a
Update android ndk to r17c for docker images
opacam Dec 18, 2018
5d782e4
Add one more dependency to our docker images
opacam Dec 18, 2018
fc657c7
Update documentation about the new python core
opacam Dec 18, 2018
929f8fc
Prevent crash on create_python_bundle
opacam Dec 4, 2018
144c4a8
Replace exit for BuildInterruptingException
opacam Dec 18, 2018
0e41ac7
Remove note of quickstart.rst
opacam Dec 18, 2018
70074bb
Redaction corrections
opacam Dec 18, 2018
1063801
Remove tuple of python versions
opacam Dec 18, 2018
39bd03a
Replace backslashes
opacam Dec 20, 2018
7075901
Fix hardcoded toolchain version and arch for python recipe
opacam Dec 20, 2018
d2b7ba5
Fix hardcoded toolchain version and arch for clang
opacam Dec 20, 2018
3ecf55c
Fix android host for python recipes
opacam Dec 21, 2018
d9eed72
Fix hardcoded target for python recipes and clang
opacam Dec 21, 2018
0a797ed
Add missing includes for clang
opacam Dec 21, 2018
1f47a69
Fix hardcoded arch for numpy
opacam Dec 21, 2018
f911677
Fix openssl build for arch x86_64
opacam Dec 21, 2018
00fe5ca
Fix openssl build for arch arm64-v8a
opacam Dec 21, 2018
e94b765
Drop commented code from python2legacy recipe
opacam Dec 21, 2018
2940c9a
Replace backslashes for openssl recipe
opacam Dec 21, 2018
54fa1d8
Fix hardcoded arch flags for libffi recipe
opacam Dec 21, 2018
6a92b26
Remove unneeded warning for numpy
opacam Dec 21, 2018
81066e2
Fix libffi build for all archs
opacam Dec 21, 2018
3ac092d
Remove lines from openssl recipe that seems not needed anymore
opacam Dec 21, 2018
6ceb46f
Replace sum with append for cflags list
opacam Dec 24, 2018
e91449f
Remove unneeded message for build.py
opacam Dec 24, 2018
d985f22
Remove commented line
opacam Dec 24, 2018
cdbf2ae
Remove unneeded files for the project
opacam Dec 24, 2018
969cdc6
Remove some unneeded lines for some of the test apps
opacam Dec 24, 2018
4083502
Remove more unneeded lines for test app and shortens line
opacam Dec 24, 2018
92f5493
Fix initsite for python2's site module
opacam Dec 26, 2018
2460d6e
Enhance python2 patches
opacam Dec 26, 2018
2e6e256
Remove unused patches
opacam Dec 26, 2018
1a4830b
Some fixes/enhancements for python2legacy
opacam Dec 26, 2018
fcac121
Change ndk downloads page
opacam Dec 27, 2018
5c71a1a
Fix clang path for crystax
opacam Dec 27, 2018
c11f540
Python2legacy: fix conflicts between python recipes
opacam Dec 27, 2018
f4ce5b8
Python2legacy: provisional fix to the hardcoded job count
opacam Dec 27, 2018
66d6394
Python2legacy: make work some basic recipes with python2legacy
opacam Dec 27, 2018
c23cde6
Python2legacy: make work sdl2 bootstrap with python2legacy
opacam Dec 27, 2018
c32741e
Python2legacy: fix get_site_packages_dir for python2legacy
opacam Dec 27, 2018
0fb5116
Python2legacy: fix strip_libraries for python2legacy
opacam Dec 27, 2018
bd7d4c1
Python2legacy: make the necessary changes to recipe.py to make it wor…
opacam Dec 27, 2018
7a7d9f6
Python2legacy: make it work the openssl libs with python2legacy and p…
opacam Dec 27, 2018
977a86d
Python2legacy: add a test app for python2legacy (with openssl and sql…
opacam Dec 27, 2018
dbbd3f8
Python2legacy: update README file
opacam Dec 28, 2018
bdd2b7c
Move libraries from LDFLAGS to LIBS
opacam Jan 5, 2019
99ee28b
Fix linkage problems with python's versioned library
opacam Jan 6, 2019
5185b1e
Revert "Fix linkage problems with python's versioned library"
opacam Jan 7, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ env:
- ANDROID_SDK_HOME=/opt/android/android-sdk
- ANDROID_NDK_HOME=/opt/android/android-ndk
matrix:
- COMMAND='. venv/bin/activate && cd testapps/ && python setup_testapp_python3.py apk --sdk-dir $ANDROID_SDK_HOME --ndk-dir $ANDROID_NDK_HOME --requirements sdl2,pyjnius,kivy,python3'
- COMMAND='. venv/bin/activate && cd testapps/ && python setup_testapp_python3_sqlite_openssl.py apk --sdk-dir $ANDROID_SDK_HOME --ndk-dir $ANDROID_NDK_HOME --requirements libffi,sdl2,pyjnius,kivy,python3,openssl,requests,sqlite3,setuptools'
# overrides requirements to skip `peewee` pure python module, see:
# https://github.com/kivy/python-for-android/issues/1263#issuecomment-390421054
- COMMAND='. venv/bin/activate && cd testapps/ && python setup_testapp_python2_sqlite_openssl.py apk --sdk-dir $ANDROID_SDK_HOME --ndk-dir $ANDROID_NDK_HOME --requirements sdl2,pyjnius,kivy,python2,openssl,requests,sqlite3,setuptools'
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.py2
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ RUN apt -y update -qq \


ENV ANDROID_NDK_HOME="${ANDROID_HOME}/android-ndk"
ENV ANDROID_NDK_VERSION="16b"
ENV ANDROID_NDK_VERSION="17c"
ENV ANDROID_NDK_HOME_V="${ANDROID_NDK_HOME}-r${ANDROID_NDK_VERSION}"

# get the latest version from https://developer.android.com/ndk/downloads/index.html
Expand Down Expand Up @@ -104,7 +104,7 @@ RUN dpkg --add-architecture i386 \
# specific recipes dependencies (e.g. libffi requires autoreconf binary)
RUN apt -y update -qq \
&& apt -y install -qq --no-install-recommends \
autoconf automake cmake gettext libltdl-dev libtool pkg-config \
libffi-dev autoconf automake cmake gettext libltdl-dev libtool pkg-config \
&& apt -y autoremove \
&& apt -y clean

Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.py3
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ RUN apt -y update -qq \


ENV ANDROID_NDK_HOME="${ANDROID_HOME}/android-ndk"
ENV ANDROID_NDK_VERSION="16b"
ENV ANDROID_NDK_VERSION="17c"
ENV ANDROID_NDK_HOME_V="${ANDROID_NDK_HOME}-r${ANDROID_NDK_VERSION}"

# get the latest version from https://developer.android.com/ndk/downloads/index.html
Expand Down Expand Up @@ -104,7 +104,7 @@ RUN dpkg --add-architecture i386 \
# specific recipes dependencies (e.g. libffi requires autoreconf binary)
RUN apt -y update -qq \
&& apt -y install -qq --no-install-recommends \
autoconf automake cmake gettext libltdl-dev libtool pkg-config \
libffi-dev autoconf automake cmake gettext libltdl-dev libtool pkg-config \
&& apt -y autoremove \
&& apt -y clean

Expand Down
19 changes: 19 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,25 @@ issues and PRs relating to this branch are still accepted. However, the
new toolchain contains all the same functionality via the built in
pygame bootstrap.

In the last quarter of 2018 the python recipes has been changed, the new recipe
for python3 (3.7.1) has a new build system which has been applied to the ancient
python recipe, allowing us to bump the python2 version number to 2.7.15. This
change, unifies the build process for both python recipes, and probably solve
some issues detected over the years, but unfortunately, this change breaks the
pygame bootstrap (in a near future we will fix it or remove it). Also should be
mentioned that the old python recipe is still usable, and has been renamed to
`python2legacy`. This `python2legacy` recipe allow us to build with a minimum
api lower than 21, which is not the case for the new python recipes which are
limited to a minimum api of 21. All this work has been done using android ndk
version r17c, and your build should success with that version...but be aware
that the project is in constant development so...the ndk version will change
at some time.

Those mentioned changes has been done this way to make easier the transition
between python3 and python2. We will slowly phase out python2 support
towards 2020...so...if you are using python2 in your projects you should
consider to migrate it into python3.

Documentation
=============

Expand Down
24 changes: 20 additions & 4 deletions doc/source/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,27 @@ named ``tools``, and you will need to run extra commands to install
the SDK packages needed.

For Android NDK, note that modern releases will only work on a 64-bit
operating system. If you are using a 32-bit distribution (or hardware),
the latest useable NDK version is r10e, which can be downloaded here:
operating system. The minimal, and recommended, NDK version to use is r17c:
opacam marked this conversation as resolved.
Show resolved Hide resolved

- `Go to ndk downloads page <https://developer.android.com/ndk/downloads/>`_
- Windows users should create a virtual machine with an GNU Linux os
installed, and then you can follow the described instructions from within
your virtual machine.

If you are using a 32-bit distribution (or hardware),
the latest usable NDK version is r10e, which can be downloaded here:

- `Legacy 32-bit Linux NDK r10e <http://dl.google.com/android/ndk/android-ndk-r10e-linux-x86.bin>`_

.. warning::
**32-bit distributions**

Since the python2 recipe updated to version 2.7.15, the build system has
been changed and you should use an old release of python-for-android, which
contains the legacy python recipe (v2.7.2). The last python-for-android
release with the legacy version of python is version
`0.6.0 <https://github.com/kivy/python-for-android/archive/0.6.0.zip>`_.

First, install a platform to target (you can also replace ``27`` with
a different platform number, this will be used again later)::

Expand All @@ -113,8 +129,8 @@ Then, you can edit your ``~/.bashrc`` or other favorite shell to include new env

# Adjust the paths!
export ANDROIDSDK="$HOME/Documents/android-sdk-27"
export ANDROIDNDK="$HOME/Documents/android-ndk-r10e"
export ANDROIDAPI="27" # Target API version of your application
export ANDROIDNDK="$HOME/Documents/android-ndk-r17c"
export ANDROIDAPI="26" # Target API version of your application
export NDKAPI="19" # Minimum supported API version of your application
export ANDROIDNDKVER="r10e" # Version of the NDK you installed

Expand Down
95 changes: 67 additions & 28 deletions pythonforandroid/archs.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from os.path import (exists, join, dirname)
from os.path import (exists, join, dirname, split)
from os import environ, uname
from glob import glob
import sys
from distutils.spawn import find_executable

Expand Down Expand Up @@ -30,13 +31,30 @@ def include_dirs(self):
d.format(arch=self))
for d in self.ctx.include_dirs]

def get_env(self, with_flags_in_cc=True):
@property
def target(self):
target_data = self.command_prefix.split('-')
return '-'.join(
[target_data[0], 'none', target_data[1], target_data[2]])

def get_env(self, with_flags_in_cc=True, clang=False):
env = {}

env['CFLAGS'] = ' '.join([
'-DANDROID', '-mandroid', '-fomit-frame-pointer'
' -D__ANDROID_API__={}'.format(self.ctx.ndk_api),
])
cflags = [
'-DANDROID',
'-fomit-frame-pointer',
'-D__ANDROID_API__={}'.format(self.ctx.ndk_api)]
if not clang:
cflags.append('-mandroid')
else:
cflags.append('-target ' + self.target)
toolchain = '{android_host}-{toolchain_version}'.format(
android_host=self.ctx.toolchain_prefix,
toolchain_version=self.ctx.toolchain_version)
toolchain = join(self.ctx.ndk_dir, 'toolchains', toolchain, 'prebuilt', 'linux-x86_64')
cflags.append('-gcc-toolchain {}'.format(toolchain))

env['CFLAGS'] = ' '.join(cflags)
env['LDFLAGS'] = ' '

sysroot = join(self.ctx._ndk_dir, 'sysroot')
Expand All @@ -45,6 +63,8 @@ def get_env(self, with_flags_in_cc=True):
# https://android.googlesource.com/platform/ndk/+/ndk-r15-release/docs/UnifiedHeaders.md
env['CFLAGS'] += ' -isystem {}/sysroot/usr/include/{}'.format(
self.ctx.ndk_dir, self.ctx.toolchain_prefix)
env['CFLAGS'] += ' -I{}/sysroot/usr/include/{}'.format(
self.ctx.ndk_dir, self.command_prefix)
else:
sysroot = self.ctx.ndk_platform
env['CFLAGS'] += ' -I{}'.format(self.ctx.ndk_platform)
Expand Down Expand Up @@ -82,8 +102,20 @@ def get_env(self, with_flags_in_cc=True):
env['NDK_CCACHE'] = self.ctx.ccache
env.update({k: v for k, v in environ.items() if k.startswith('CCACHE_')})

cc = find_executable('{command_prefix}-gcc'.format(
command_prefix=command_prefix), path=environ['PATH'])
if clang:
llvm_dirname = split(
glob(join(self.ctx.ndk_dir, 'toolchains', 'llvm*'))[-1])[-1]
clang_path = join(self.ctx.ndk_dir, 'toolchains', llvm_dirname,
'prebuilt', 'linux-x86_64', 'bin')
environ['PATH'] = '{clang_path}:{path}'.format(
clang_path=clang_path, path=environ['PATH'])
exe = join(clang_path, 'clang')
execxx = join(clang_path, 'clang++')
else:
exe = '{command_prefix}-gcc'.format(command_prefix=command_prefix)
execxx = '{command_prefix}-g++'.format(command_prefix=command_prefix)

cc = find_executable(exe, path=environ['PATH'])
if cc is None:
print('Searching path are: {!r}'.format(environ['PATH']))
raise BuildInterruptingException(
Expand All @@ -93,20 +125,20 @@ def get_env(self, with_flags_in_cc=True):
'installed. Exiting.')
KeyWeeUsr marked this conversation as resolved.
Show resolved Hide resolved

if with_flags_in_cc:
env['CC'] = '{ccache}{command_prefix}-gcc {cflags}'.format(
command_prefix=command_prefix,
env['CC'] = '{ccache}{exe} {cflags}'.format(
exe=exe,
ccache=ccache,
cflags=env['CFLAGS'])
env['CXX'] = '{ccache}{command_prefix}-g++ {cxxflags}'.format(
command_prefix=command_prefix,
env['CXX'] = '{ccache}{execxx} {cxxflags}'.format(
execxx=execxx,
ccache=ccache,
cxxflags=env['CXXFLAGS'])
else:
env['CC'] = '{ccache}{command_prefix}-gcc'.format(
command_prefix=command_prefix,
env['CC'] = '{ccache}{exe}'.format(
exe=exe,
ccache=ccache)
env['CXX'] = '{ccache}{command_prefix}-g++'.format(
command_prefix=command_prefix,
env['CXX'] = '{ccache}{execxx}'.format(
execxx=execxx,
ccache=ccache)

env['AR'] = '{}-ar'.format(command_prefix)
Expand All @@ -123,12 +155,13 @@ def get_env(self, with_flags_in_cc=True):
env['READELF'] = '{}-readelf'.format(command_prefix)
env['NM'] = '{}-nm'.format(command_prefix)

hostpython_recipe = Recipe.get_recipe('hostpython2', self.ctx)

# This hardcodes python version 2.7, needs fixing
hostpython_recipe = Recipe.get_recipe(
'host' + self.ctx.python_recipe.name, self.ctx)
env['BUILDLIB_PATH'] = join(
hostpython_recipe.get_build_dir(self.arch),
'build', 'lib.linux-{}-2.7'.format(uname()[-1]))
'build', 'lib.linux-{}-{}'.format(
uname()[-1], self.ctx.python_recipe.major_minor_version_string)
)

env['PATH'] = environ['PATH']

Expand All @@ -147,12 +180,18 @@ class ArchARM(Arch):
command_prefix = 'arm-linux-androideabi'
platform_dir = 'arch-arm'

@property
def target(self):
target_data = self.command_prefix.split('-')
return '-'.join(
['armv7a', 'none', target_data[1], target_data[2]])


class ArchARMv7_a(ArchARM):
arch = 'armeabi-v7a'

def get_env(self, with_flags_in_cc=True):
env = super(ArchARMv7_a, self).get_env(with_flags_in_cc)
def get_env(self, with_flags_in_cc=True, clang=False):
env = super(ArchARMv7_a, self).get_env(with_flags_in_cc, clang=clang)
env['CFLAGS'] = (env['CFLAGS'] +
(' -march=armv7-a -mfloat-abi=softfp '
'-mfpu=vfp -mthumb'))
Expand All @@ -166,8 +205,8 @@ class Archx86(Arch):
command_prefix = 'i686-linux-android'
platform_dir = 'arch-x86'

def get_env(self, with_flags_in_cc=True):
env = super(Archx86, self).get_env(with_flags_in_cc)
def get_env(self, with_flags_in_cc=True, clang=False):
env = super(Archx86, self).get_env(with_flags_in_cc, clang=clang)
env['CFLAGS'] = (env['CFLAGS'] +
' -march=i686 -mtune=intel -mssse3 -mfpmath=sse -m32')
env['CXXFLAGS'] = env['CFLAGS']
Expand All @@ -180,8 +219,8 @@ class Archx86_64(Arch):
command_prefix = 'x86_64-linux-android'
platform_dir = 'arch-x86_64'

def get_env(self, with_flags_in_cc=True):
env = super(Archx86_64, self).get_env(with_flags_in_cc)
def get_env(self, with_flags_in_cc=True, clang=False):
env = super(Archx86_64, self).get_env(with_flags_in_cc, clang=clang)
env['CFLAGS'] = (env['CFLAGS'] +
' -march=x86-64 -msse4.2 -mpopcnt -m64 -mtune=intel')
env['CXXFLAGS'] = env['CFLAGS']
Expand All @@ -194,8 +233,8 @@ class ArchAarch_64(Arch):
command_prefix = 'aarch64-linux-android'
platform_dir = 'arch-arm64'

def get_env(self, with_flags_in_cc=True):
env = super(ArchAarch_64, self).get_env(with_flags_in_cc)
def get_env(self, with_flags_in_cc=True, clang=False):
env = super(ArchAarch_64, self).get_env(with_flags_in_cc, clang=clang)
incpath = ' -I' + join(dirname(__file__), 'includes', 'arm64-v8a')
env['EXTRA_CFLAGS'] = incpath
env['CFLAGS'] += incpath
Expand Down
15 changes: 7 additions & 8 deletions pythonforandroid/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,14 +269,13 @@ def strip_libraries(self, arch):
return
strip = sh.Command(strip)

if self.ctx.python_recipe.name == 'python2':
filens = shprint(sh.find, join(self.dist_dir, 'private'),
join(self.dist_dir, 'libs'),
'-iname', '*.so', _env=env).stdout.decode('utf-8')
else:
filens = shprint(sh.find, join(self.dist_dir, '_python_bundle', '_python_bundle', 'modules'),
join(self.dist_dir, 'libs'),
'-iname', '*.so', _env=env).stdout.decode('utf-8')
libs_dir = join(self.dist_dir, '_python_bundle',
'_python_bundle', 'modules')
if self.ctx.python_recipe.name == 'python2legacy':
libs_dir = join(self.dist_dir, 'private')
filens = shprint(sh.find, libs_dir, join(self.dist_dir, 'libs'),
'-iname', '*.so', _env=env).stdout.decode('utf-8')

logger.info('Stripping libraries in private dir')
for filen in filens.split('\n'):
try:
Expand Down
2 changes: 0 additions & 2 deletions pythonforandroid/bootstraps/common/build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ def get_bootstrap_name():
# Try to find a host version of Python that matches our ARM version.
PYTHON = join(curdir, 'python-install', 'bin', 'python.host')
if not exists(PYTHON):
print('Could not find hostpython, will not compile to .pyo (this is normal with python3)')
PYTHON = None

BLACKLIST_PATTERNS = [
Expand Down Expand Up @@ -151,7 +150,6 @@ def make_python_zip():

if not exists('private'):
print('No compiled python is present to zip, skipping.')
print('this should only be the case if you are using the CrystaX python')
return

global python_files
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ int main(int argc, char *argv[]) {
LOGP(env_argument);
chdir(env_argument);

#if PY_MAJOR_VERSION < 3
Py_NoSiteFlag=1;
#endif

Py_SetProgramName(L"android_python");

#if PY_MAJOR_VERSION >= 3
Expand Down Expand Up @@ -144,10 +148,6 @@ int main(int argc, char *argv[]) {
#if PY_MAJOR_VERSION >= 3
wchar_t *wchar_paths = Py_DecodeLocale(paths, NULL);
Py_SetPath(wchar_paths);
#else
char *wchar_paths = paths;
LOGP("Can't Py_SetPath in python2, so crystax python2 doesn't work yet");
exit(1);
#endif

LOGP("set wchar paths...");
Expand All @@ -161,6 +161,12 @@ int main(int argc, char *argv[]) {
Py_Initialize();

#if PY_MAJOR_VERSION < 3
// Can't Py_SetPath in python2 but we can set PySys_SetPath, which must
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if we should just omit this change, since SSL works with python 3 now and crystax becomes increasingly unnecessary. I think the better plan is to dump Crystax very soon. OpenSSL is as far as I know the only part remaining that doesn't work with @inclement 's new python 3 recipe, and you're fixing this right here in this pull request.

Or is this also useful/necessary in some way for non-crystax builds?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we cannot remove this line because we need that for the new version of python2 which also use the python_bundle_dir like python3.

// be applied after Py_Initialize rather than before like Py_SetPath
#if PY_MICRO_VERSION >= 15
// Only for python native-build
PySys_SetPath(paths);
#endif
PySys_SetArgv(argc, argv);
#endif

Expand All @@ -183,7 +189,9 @@ int main(int argc, char *argv[]) {
*/
PyRun_SimpleString("import sys, posix\n");
if (dir_exists("lib")) {
/* If we built our own python, set up the paths correctly */
/* If we built our own python, set up the paths correctly.
* This is only the case if we are using the python2legacy recipe
*/
LOGP("Setting up python from ANDROID_APP_PATH");
PyRun_SimpleString("private = posix.environ['ANDROID_APP_PATH']\n"
"argument = posix.environ['ANDROID_ARGUMENT']\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ LOCAL_CFLAGS := $(foreach D, $(APP_SUBDIRS), -I$(LOCAL_PATH)/$(D)) \
-I$(LOCAL_PATH)/../jpeg \
-I$(LOCAL_PATH)/../intl \
-I$(LOCAL_PATH)/.. \
-I$(LOCAL_PATH)/../../../../other_builds/$(PYTHON2_NAME)/$(ARCH)/python2/python-install/include/python2.7
# -I$(LOCAL_PATH)/../../../../python-install/include/python2.7
# -I$(LOCAL_PATH)/../../../build/python-install/include/python2.7
-I$(LOCAL_PATH)/../../../../other_builds/$(MK_PYTHON_INCLUDE_ROOT)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just use $PYTHON_INCLUDE_ROOT and $PYTHON_LINK_ROOT, see other comments.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that we can replace them because the variables you propose are absolute paths, and we need them relative paths.



LOCAL_CFLAGS += $(APPLICATION_ADDITIONAL_CFLAGS)
Expand All @@ -40,7 +38,7 @@ LOCAL_LDLIBS := -lpython2.7 -lGLESv1_CM -ldl -llog -lz

# AND: Another hardcoded path that should be templated
# AND: NOT TEMPALTED! We can use $ARCH
LOCAL_LDFLAGS += -L$(LOCAL_PATH)/../../../../other_builds/$(PYTHON2_NAME)/$(ARCH)/python2/python-install/lib $(APPLICATION_ADDITIONAL_LDFLAGS)
LOCAL_LDFLAGS += -L$(LOCAL_PATH)/../../../../other_builds/$(MK_PYTHON_LINK_ROOT) $(APPLICATION_ADDITIONAL_LDFLAGS)

LIBS_WITH_LONG_SYMBOLS := $(strip $(shell \
for f in $(LOCAL_PATH)/../../libs/$ARCH/*.so ; do \
Expand Down
Loading