-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Python 3.8 support on Android #2044
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
ae59f8a
Did basic changes for Python3.8 support
inclement d2714df
Added python 3.8.1 patch to git
inclement d7e9d9d
Added infrastructure for recipe-version-dependent patching
inclement 61fcf11
Added --fix-cortex-a8 removal patch for py3.8.1
inclement bc292d4
Fully set up Python3 patches to work with both 3.7.1 and 3.8.1
inclement 4e180ee
Fixed bugs in is_version_{lt,gt} patching helpers
inclement b3e7676
Replaced func call with pre-existing variable reference
inclement 7fcf06b
Added some blank lines to make pep8 happy
inclement File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import sh | ||
from pythonforandroid.python import GuestPythonRecipe | ||
from pythonforandroid.recipe import Recipe | ||
from pythonforandroid.patching import version_starts_with | ||
|
||
|
||
class Python3Recipe(GuestPythonRecipe): | ||
|
@@ -18,15 +19,24 @@ class Python3Recipe(GuestPythonRecipe): | |
:class:`~pythonforandroid.python.GuestPythonRecipe` | ||
''' | ||
|
||
version = '3.7.1' | ||
version = '3.8.1' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why bumping the default version to something "cutting edge"? I think it's great that we support it, but maybe it's a bit early to bump it as a default at the same time? |
||
url = 'https://www.python.org/ftp/python/{version}/Python-{version}.tgz' | ||
name = 'python3' | ||
|
||
patches = ['patches/fix-ctypes-util-find-library.patch', | ||
'patches/fix-zlib-version.patch'] | ||
patches = [ | ||
# Python 3.7.1 | ||
('patches/py3.7.1_fix-ctypes-util-find-library.patch', version_starts_with("3.7")), | ||
('patches/py3.7.1_fix-zlib-version.patch', version_starts_with("3.7")), | ||
|
||
# Python 3.8.1 | ||
('patches/py3.8.1.patch', version_starts_with("3.8")) | ||
] | ||
|
||
if sh.which('lld') is not None: | ||
patches = patches + ["patches/remove-fix-cortex-a8.patch"] | ||
patches = patches + [ | ||
("patches/py3.7.1_remove-fix-cortex-a8.patch", version_starts_with("3.7")), | ||
("patches/py3.8.1_remove-fix-cortex-a8.patch", version_starts_with("3.8")) | ||
] | ||
|
||
depends = ['hostpython3', 'sqlite3', 'openssl', 'libffi'] | ||
conflicts = ['python2'] | ||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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: |
18 changes: 18 additions & 0 deletions
18
pythonforandroid/recipes/python3/patches/py3.8.1_fix_cortex_a8.patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
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 | ||
@@ -18673,4 +18673,3 @@ if test "$Py_OPT" = 'false' -a "$Py_DEBUG" != 'true'; then | ||
echo "" >&6 | ||
echo "" >&6 | ||
fi | ||
- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.