From 75cbd5c7082d50deb2fc2006b3e83b083603bfdd Mon Sep 17 00:00:00 2001 From: Mirko Galimberti Date: Sat, 21 Oct 2023 14:46:40 +0200 Subject: [PATCH] Update `python3` recipe to `3.11.6` (#870) --- kivy_ios/recipes/hostpython3/__init__.py | 10 +++--- kivy_ios/recipes/python3/ModulesSetup | 20 ++++++------ kivy_ios/recipes/python3/__init__.py | 31 ++++++++++--------- kivy_ios/recipes/python3/configure.patch | 31 ++++++++++--------- .../recipes/python3/ctypes_duplicate.patch | 19 ------------ kivy_ios/recipes/python3/posixmodule.patch | 12 ------- .../main.m | 2 +- .../project.pbxproj | 4 +-- 8 files changed, 51 insertions(+), 78 deletions(-) delete mode 100644 kivy_ios/recipes/python3/ctypes_duplicate.patch delete mode 100644 kivy_ios/recipes/python3/posixmodule.patch diff --git a/kivy_ios/recipes/hostpython3/__init__.py b/kivy_ios/recipes/hostpython3/__init__.py index d54b73e39..9ffa195f7 100644 --- a/kivy_ios/recipes/hostpython3/__init__.py +++ b/kivy_ios/recipes/hostpython3/__init__.py @@ -11,7 +11,7 @@ class Hostpython3Recipe(HostRecipe): - version = "3.10.10" + version = "3.11.6" url = "https://www.python.org/ftp/python/{version}/Python-{version}.tgz" depends = ["hostopenssl"] optional_depends = [] @@ -19,8 +19,8 @@ class Hostpython3Recipe(HostRecipe): def init_with_ctx(self, ctx): super().init_with_ctx(ctx) - self.set_hostpython(self, "3.10") - self.ctx.so_suffix = ".cpython-310m-darwin.so" + self.set_hostpython(self, "3.11") + self.ctx.so_suffix = ".cpython-311m-darwin.so" self.ctx.hostpython = join(self.ctx.dist_dir, "hostpython3", "bin", "python") self.ctx.hostpgen = join(self.ctx.dist_dir, "hostpython3", "bin", "pgen") logger.info("Global: hostpython located at {}".format(self.ctx.hostpython)) @@ -88,7 +88,7 @@ def install(self): join(self.ctx.dist_dir, "hostpython3", "bin", "python")) # hostpython3 installs bundled versions of `pip` - # and `setuptools` in `lib/python3.10/site-packages`. + # and `setuptools` in `lib/python3.x/site-packages`. # This is fine, but `setuptools` have a bug that prevents # it from working properly when cross-compiling, so we # patch it here. @@ -100,7 +100,7 @@ def install(self): self.ctx.dist_dir, "hostpython3", "lib", - "python3.10", + "python3.11", "site-packages", "setuptools", ), diff --git a/kivy_ios/recipes/python3/ModulesSetup b/kivy_ios/recipes/python3/ModulesSetup index dc327caf5..6afe98d08 100644 --- a/kivy_ios/recipes/python3/ModulesSetup +++ b/kivy_ios/recipes/python3/ModulesSetup @@ -6,15 +6,15 @@ _asyncio _asynciomodule.c _bisect _bisectmodule.c _blake2 _blake2/blake2module.c _blake2/blake2b_impl.c _blake2/blake2s_impl.c -_sqlite3 _sqlite/cache.c \ - _sqlite/connection.c \ - _sqlite/cursor.c \ - _sqlite/microprotocols.c \ - _sqlite/module.c \ - _sqlite/prepare_protocol.c \ - _sqlite/row.c \ - _sqlite/statement.c \ - _sqlite/util.c -DSQLITE_OMIT_LOAD_EXTENSION +_sqlite3 _sqlite/blob.c \ + _sqlite/connection.c \ + _sqlite/cursor.c \ + _sqlite/microprotocols.c \ + _sqlite/module.c \ + _sqlite/prepare_protocol.c \ + _sqlite/row.c \ + _sqlite/statement.c \ + _sqlite/util.c -DSQLITE_OMIT_LOAD_EXTENSION _bz2 _bz2module.c -I$(srcdir)/../bzip2/include -L$(srcdir)/../Support/BZip2 -lbz2 _codecs_cn cjkcodecs/_codecs_cn.c _codecs_hk cjkcodecs/_codecs_hk.c @@ -52,9 +52,9 @@ _struct _struct.c array arraymodule.c audioop audioop.c binascii binascii.c -cmath cmathmodule.c _math.c fcntl fcntlmodule.c grp grpmodule.c +cmath cmathmodule.c math mathmodule.c mmap mmapmodule.c pyexpat expat/xmlparse.c \ diff --git a/kivy_ios/recipes/python3/__init__.py b/kivy_ios/recipes/python3/__init__.py index 2d1987474..4e380810f 100644 --- a/kivy_ios/recipes/python3/__init__.py +++ b/kivy_ios/recipes/python3/__init__.py @@ -9,16 +9,16 @@ class Python3Recipe(Recipe): - version = "3.10.10" + version = "3.11.6" url = "https://www.python.org/ftp/python/{version}/Python-{version}.tgz" depends = ["hostpython3", "libffi", "openssl"] - library = "libpython3.10.a" + library = "libpython3.11.a" pbx_libraries = ["libz", "libbz2", "libsqlite3"] def init_with_ctx(self, ctx): super().init_with_ctx(ctx) - self.set_python(self, "3.10") - ctx.python_ver_dir = "python3.10" + self.set_python(self, "3.11") + ctx.python_ver_dir = "python3.11" ctx.python_prefix = join(ctx.dist_dir, "root", "python3") ctx.site_packages_dir = join( ctx.python_prefix, "lib", ctx.python_ver_dir, "site-packages") @@ -28,9 +28,7 @@ def prebuild_platform(self, plat): if self.has_marker("patched"): return self.apply_patch("configure.patch") - self.apply_patch("posixmodule.patch") self.apply_patch("dynload_shlib.patch") - self.apply_patch("ctypes_duplicate.patch") self.copy_file("ModulesSetup", "Modules/Setup.local") self.append_file("ModulesSetup.mobile", "Modules/Setup.local") self.set_marker("patched") @@ -97,10 +95,15 @@ def build_platform(self, plat): "ac_cv_func_explicit_bzero=no", "ac_cv_func_explicit_memset=no", "ac_cv_func_close_range=no", + "ac_cv_search_crypt_r=no", + "ac_cv_func_fork1=no", + "ac_cv_func_system=no", + "ac_cv_func_clock_nanosleep=no", "ac_cv_func_splice=no", "ac_cv_func_mremap=no", "--host={}-apple-ios".format(py_arch), "--build=x86_64-apple-darwin", + "--with-build-python={}".format(join(self.ctx.dist_dir, "hostpython3", "bin", "python3")), "--prefix={}".format(prefix), "--without-ensurepip", "--with-system-ffi", @@ -132,9 +135,9 @@ def reduce_python(self): # platform binaries and configuration with cd(join( self.ctx.dist_dir, "root", "python3", "lib", - "python3.10", "config-3.10-darwin")): + "python3.11", "config-3.11-darwin")): sh.rm( - "libpython3.10.a", + "libpython3.11.a", "python.o", "config.c.in", "makesetup", @@ -143,11 +146,11 @@ def reduce_python(self): # cleanup pkgconfig and compiled lib with cd(join(self.ctx.dist_dir, "root", "python3", "lib")): - sh.rm("-rf", "pkgconfig", "libpython3.10.a") + sh.rm("-rf", "pkgconfig", "libpython3.11.a") # cleanup python libraries with cd(join( - self.ctx.dist_dir, "root", "python3", "lib", "python3.10")): + self.ctx.dist_dir, "root", "python3", "lib", "python3.11")): sh.rm("-rf", "wsgiref", "curses", "idlelib", "lib2to3", "ensurepip", "turtledemo", "lib-dynload", "venv", "pydoc_data") @@ -168,12 +171,12 @@ def reduce_python(self): sh.find(".", "-name", "__pycache__", "-type", "d", "-delete") # create the lib zip - logger.info("Create a python3.10.zip") - sh.mv("config-3.10-darwin", "..") + logger.info("Create a python3.11.zip") + sh.mv("config-3.11-darwin", "..") sh.mv("site-packages", "..") - sh.zip("-r", "../python310.zip", sh.glob("*")) + sh.zip("-r", "../python311.zip", sh.glob("*")) sh.rm("-rf", sh.glob("*")) - sh.mv("../config-3.10-darwin", ".") + sh.mv("../config-3.11-darwin", ".") sh.mv("../site-packages", ".") diff --git a/kivy_ios/recipes/python3/configure.patch b/kivy_ios/recipes/python3/configure.patch index 7ab39391e..e0267237c 100644 --- a/kivy_ios/recipes/python3/configure.patch +++ b/kivy_ios/recipes/python3/configure.patch @@ -1,7 +1,6 @@ -diff -Naur Python-3.10.10.orig/configure Python-3.10.10/configure ---- Python-3.10.10.orig/configure 2023-02-12 15:08:28 -+++ Python-3.10.10/configure 2023-02-12 15:10:45 -@@ -3344,6 +3344,15 @@ +--- Python-3.11.6/configure.orig 2023-10-15 12:23:31 ++++ Python-3.11.6/configure 2023-10-15 12:30:23 +@@ -3823,6 +3823,15 @@ *-*-cygwin*) ac_sys_system=Cygwin ;; @@ -17,7 +16,7 @@ diff -Naur Python-3.10.10.orig/configure Python-3.10.10/configure *-*-vxworks*) ac_sys_system=VxWorks ;; -@@ -3391,6 +3400,15 @@ +@@ -3876,6 +3885,15 @@ _host_cpu=$host_cpu esac ;; @@ -33,13 +32,14 @@ diff -Naur Python-3.10.10.orig/configure Python-3.10.10/configure *-*-cygwin*) _host_cpu= ;; -@@ -3469,6 +3487,13 @@ +@@ -3956,7 +3974,14 @@ + Darwin/[6789].*) define_xopen_source=no;; Darwin/[12][0-9].*) - define_xopen_source=no;; ++ define_xopen_source=no;; + # On iOS, defining _POSIX_C_SOURCE also disables platform specific features. + iOS/*) -+ define_xopen_source=no;; + define_xopen_source=no;; + tvOS/*) + define_xopen_source=no;; + watchOS/*) @@ -47,7 +47,7 @@ diff -Naur Python-3.10.10.orig/configure Python-3.10.10/configure # On QNX 6.3.2, defining _XOPEN_SOURCE prevents netdb.h from # defining NI_NUMERICHOST. QNX/6.3.2) -@@ -5389,6 +5414,12 @@ +@@ -6204,6 +6229,12 @@ case $ac_sys_system in #( Darwin*) : MULTIARCH="" ;; #( @@ -60,7 +60,7 @@ diff -Naur Python-3.10.10.orig/configure Python-3.10.10/configure FreeBSD*) : MULTIARCH="" ;; #( *) : -@@ -6249,11 +6280,17 @@ +@@ -7210,11 +7241,17 @@ fi if test "$cross_compiling" = yes; then @@ -83,15 +83,16 @@ diff -Naur Python-3.10.10.orig/configure Python-3.10.10/configure fi -@@ -7051,7 +7088,6 @@ +@@ -8259,7 +8296,7 @@ # tweak BASECFLAGS based on compiler and platform case $GCC in yes) -- CFLAGS_NODIST="$CFLAGS_NODIST -std=c99" +- CFLAGS_NODIST="$CFLAGS_NODIST -std=c11" ++ CFLAGS_NODIST="$CFLAGS_NODIST -std=c11" # + + - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -Wextra" >&5 - $as_echo_n "checking for -Wextra... " >&6; } -@@ -11912,6 +11948,10 @@ +@@ -15157,6 +15194,10 @@ then case $ac_sys_system/$ac_sys_release in hp*|HP*) DYNLOADFILE="dynload_hpux.o";; diff --git a/kivy_ios/recipes/python3/ctypes_duplicate.patch b/kivy_ios/recipes/python3/ctypes_duplicate.patch deleted file mode 100644 index ecb0a3726..000000000 --- a/kivy_ios/recipes/python3/ctypes_duplicate.patch +++ /dev/null @@ -1,19 +0,0 @@ -diff -Naur Python-3.8.2.orig/Modules/_ctypes/cfield.c Python-3.8.2/Modules/_ctypes/cfield.c ---- Python-3.8.2.orig/Modules/_ctypes/cfield.c 2020-04-13 12:23:46.000000000 +0200 -+++ Python-3.8.2/Modules/_ctypes/cfield.c 2020-04-13 12:24:45.000000000 +0200 -@@ -1636,7 +1636,7 @@ - struct _ffi_type **elements; - } ffi_type; - */ -- -+#if 0 - /* align and size are bogus for void, but they must not be zero */ - ffi_type ffi_type_void = { 1, 1, FFI_TYPE_VOID }; - -@@ -1663,5 +1663,5 @@ - FFI_TYPE_LONGDOUBLE }; - - ffi_type ffi_type_pointer = { sizeof(void *), VOID_P_ALIGN, FFI_TYPE_POINTER }; -- -+#endif - /*---------------- EOF ----------------*/ diff --git a/kivy_ios/recipes/python3/posixmodule.patch b/kivy_ios/recipes/python3/posixmodule.patch deleted file mode 100644 index a4953ebcd..000000000 --- a/kivy_ios/recipes/python3/posixmodule.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -Naur Python-3.9.2.orig/Modules/posixmodule.c Python-3.9.2/Modules/posixmodule.c ---- Python-3.9.2.orig/Modules/posixmodule.c 2021-03-20 12:28:02.000000000 +0100 -+++ Python-3.9.2/Modules/posixmodule.c 2021-03-20 12:29:00.000000000 +0100 -@@ -326,7 +326,7 @@ - # define HAVE_KILL 1 - # define HAVE_OPENDIR 1 - # define HAVE_PIPE 1 --# define HAVE_SYSTEM 1 -+# undef HAVE_SYSTEM - # define HAVE_WAIT 1 - # define HAVE_TTYNAME 1 - # endif /* _MSC_VER */ diff --git a/kivy_ios/tools/templates/{{ cookiecutter.project_name }}-ios/main.m b/kivy_ios/tools/templates/{{ cookiecutter.project_name }}-ios/main.m index 7458702da..517eceb37 100644 --- a/kivy_ios/tools/templates/{{ cookiecutter.project_name }}-ios/main.m +++ b/kivy_ios/tools/templates/{{ cookiecutter.project_name }}-ios/main.m @@ -52,7 +52,7 @@ int main(int argc, char *argv[]) { NSString *python_home = [NSString stringWithFormat:@"PYTHONHOME=%@", resourcePath, nil]; putenv((char *)[python_home UTF8String]); - NSString *python_path = [NSString stringWithFormat:@"PYTHONPATH=%@:%@/lib/python3.10/:%@/lib/python3.10/site-packages:.", resourcePath, resourcePath, resourcePath, nil]; + NSString *python_path = [NSString stringWithFormat:@"PYTHONPATH=%@:%@/lib/python3.11/:%@/lib/python3.11/site-packages:.", resourcePath, resourcePath, resourcePath, nil]; putenv((char *)[python_path UTF8String]); NSString *tmp_path = [NSString stringWithFormat:@"TMP=%@/tmp", resourcePath, nil]; diff --git a/kivy_ios/tools/templates/{{ cookiecutter.project_name }}-ios/{{ cookiecutter.project_name }}.xcodeproj/project.pbxproj b/kivy_ios/tools/templates/{{ cookiecutter.project_name }}-ios/{{ cookiecutter.project_name }}.xcodeproj/project.pbxproj index 026fad0f9..3235a30bd 100755 --- a/kivy_ios/tools/templates/{{ cookiecutter.project_name }}-ios/{{ cookiecutter.project_name }}.xcodeproj/project.pbxproj +++ b/kivy_ios/tools/templates/{{ cookiecutter.project_name }}-ios/{{ cookiecutter.project_name }}.xcodeproj/project.pbxproj @@ -252,7 +252,7 @@ GCC_PREPROCESSOR_DEFINITIONS = "DEBUG=1"; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; HEADER_SEARCH_PATHS = ( - "{{ cookiecutter.dist_dir }}/root/python3/include/python3.10/**", + "{{ cookiecutter.dist_dir }}/root/python3/include/python3.11/**", "{{ cookiecutter.dist_dir }}/include/common/sdl2", ); INFOPLIST_FILE = "{{ cookiecutter.project_name }}-Info.plist"; @@ -288,7 +288,7 @@ GCC_PREFIX_HEADER = ""; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; HEADER_SEARCH_PATHS = ( - "{{ cookiecutter.dist_dir }}/root/python3/include/python3.10/**", + "{{ cookiecutter.dist_dir }}/root/python3/include/python3.11/**", "{{ cookiecutter.dist_dir }}/include/common/sdl2", ); INFOPLIST_FILE = "{{ cookiecutter.project_name }}-Info.plist";