Skip to content

Commit

Permalink
python: update to 3.11.4
Browse files Browse the repository at this point in the history
  • Loading branch information
T-Dynamos committed Jul 8, 2023
1 parent 4ebd3a8 commit 27130b2
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ protected static ArrayList<String> getLibraries(File libsDir) {
libsList.add("python3.8");
libsList.add("python3.9");
libsList.add("python3.10");
libsList.add("python3.11");
libsList.add("main");
return libsList;
}
Expand All @@ -74,7 +75,7 @@ public static void loadLibraries(File filesDir, File libsDir) {
// load, and it has failed, give a more
// general error
Log.v(TAG, "Library loading error: " + e.getMessage());
if (lib.startsWith("python3.10") && !foundPython) {
if (lib.startsWith("python3.11") && !foundPython) {
throw new RuntimeException("Could not load any libpythonXXX.so");
} else if (lib.startsWith("python")) {
continue;
Expand Down
2 changes: 1 addition & 1 deletion pythonforandroid/recipes/hostpython3/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class HostPython3Recipe(Recipe):
:class:`~pythonforandroid.python.HostPythonRecipe`
'''

version = '3.10.10'
version = '3.11.4'
name = 'hostpython3'

build_subdir = 'native-build'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
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 @@
--- Python-3.11.4/Lib/site.py 2023-06-07 03:30:27.000000000 +0530
+++ Python-3.11.4.mod/Lib/site.py 2023-07-08 11:31:15.088734501 +0530
@@ -523,8 +523,7 @@
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', file=sys.stderr)

sys.prefix = sys.exec_prefix = site_prefix

# Doing this here ensures venv takes precedence over user-site
12 changes: 9 additions & 3 deletions pythonforandroid/recipes/python3/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class Python3Recipe(TargetPythonRecipe):
:class:`~pythonforandroid.python.GuestPythonRecipe`
'''

version = '3.10.10'
version = '3.11.4'
url = 'https://www.python.org/ftp/python/{version}/Python-{version}.tgz'
name = 'python3'

Expand All @@ -79,7 +79,8 @@ class Python3Recipe(TargetPythonRecipe):
("patches/py3.7.1_fix_cortex_a8.patch", version_starts_with("3.7")),
("patches/py3.8.1_fix_cortex_a8.patch", version_starts_with("3.8")),
("patches/py3.8.1_fix_cortex_a8.patch", version_starts_with("3.9")),
("patches/py3.8.1_fix_cortex_a8.patch", version_starts_with("3.10"))
("patches/py3.8.1_fix_cortex_a8.patch", version_starts_with("3.10")),
("patches/py3.11.4_fix_cortex_a8.patch", version_starts_with("3.11"))
]

depends = ['hostpython3', 'sqlite3', 'openssl', 'libffi']
Expand All @@ -92,6 +93,7 @@ class Python3Recipe(TargetPythonRecipe):
configure_args = (
'--host={android_host}',
'--build={android_build}',
'--with-build-python={python_host_bin}',
'--enable-shared',
'--enable-ipv6',
'ac_cv_file__dev_ptmx=yes',
Expand All @@ -101,7 +103,8 @@ class Python3Recipe(TargetPythonRecipe):
'ac_cv_header_sys_eventfd_h=no',
'--prefix={prefix}',
'--exec-prefix={exec_prefix}',
'--enable-loadable-sqlite-extensions')
'--enable-loadable-sqlite-extensions'
)
'''The configure arguments needed to build the python recipe. Those are
used in method :meth:`build_arch` (if not overwritten like python3's
recipe does).
Expand Down Expand Up @@ -323,6 +326,9 @@ def build_arch(self, arch):
*(' '.join(self.configure_args).format(
android_host=env['HOSTARCH'],
android_build=android_build,
python_host_bin=join(self.get_recipe(
'host' + self.name, self.ctx
).get_path_to_python(), "bin", "python3"),
prefix=sys_prefix,
exec_prefix=sys_exec_prefix)).split(' '),
_env=env)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- Python-3.11.4/configure 2023-06-07 03:30:27.000000000 +0530
+++ Python-3.11.4.mod/configure 2023-07-08 11:51:11.031135937 +0530
@@ -6994,7 +6994,7 @@
printf "%s\n" "$_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
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not Android" >&5
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py
--- a/Lib/ctypes/util.py
+++ b/Lib/ctypes/util.py
@@ -67,4 +67,11 @@
return fname
return None
--- Python-3.11.4/Lib/ctypes/util.py 2023-06-07 03:30:27.000000000 +0530
+++ Python-3.11.4.mod/Lib/ctypes/util.py 2023-07-08 11:44:53.453482872 +0530
@@ -3,8 +3,15 @@
import subprocess
import sys

+# This patch overrides the find_library to look in the right places on
+# Android
Expand All @@ -12,4 +11,9 @@ diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py
+ def find_library(name):
+ return _find_lib(name)
+
elif os.name == "posix" and sys.platform == "darwin":
# find_library(name) returns the pathname of a library, or None.
-if os.name == "nt":
+elif os.name == "nt":

def _get_build_version():
"""Return the version of MSVC that was used to build Python.
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
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 @@
--- Python-3.11.4/Lib/site.py 2023-06-07 03:30:27.000000000 +0530
+++ Python-3.11.4.mod/Lib/site.py 2023-07-08 11:31:15.088734501 +0530
@@ -523,8 +523,7 @@
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')

-
+ print('Ignoring "sys._home = value" override', file=sys.stderr)
sys.prefix = sys.exec_prefix = site_prefix

# Doing this here ensures venv takes precedence over user-site
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
# 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) \
--- Python-3.11.4/Makefile.pre.in 2023-06-07 03:30:27.000000000 +0530
+++ Python-3.11.4.mod/Makefile.pre.in 2023-07-08 11:38:12.788515487 +0530
@@ -1238,6 +1238,8 @@
-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)"') \
+ $(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
Modules/getpath.o: $(srcdir)/Modules/getpath.c Python/frozen_modules/getpath.h Makefile $(PYTHON_HEADERS)

0 comments on commit 27130b2

Please sign in to comment.