Skip to content

Commit

Permalink
Upgrade to Python 3.12.6
Browse files Browse the repository at this point in the history
  • Loading branch information
kentbull committed Sep 27, 2024
1 parent 09ec398 commit ada65c9
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
8 changes: 4 additions & 4 deletions kivy_ios/recipes/hostpython3/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@


class Hostpython3Recipe(HostRecipe):
version = "3.11.6"
version = "3.12.6"
url = "https://www.python.org/ftp/python/{version}/Python-{version}.tgz"
depends = ["hostopenssl"]
optional_depends = []
build_subdir = 'native-build'

def init_with_ctx(self, ctx):
super().init_with_ctx(ctx)
self.set_hostpython(self, "3.11")
self.ctx.so_suffix = ".cpython-311m-darwin.so"
self.set_hostpython(self, "3.12")
self.ctx.so_suffix = ".cpython-312m-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))
Expand Down Expand Up @@ -100,7 +100,7 @@ def install(self):
self.ctx.dist_dir,
"hostpython3",
"lib",
"python3.11",
"python3.12",
"site-packages",
"setuptools",
),
Expand Down
22 changes: 11 additions & 11 deletions kivy_ios/recipes/python3/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@


class Python3Recipe(Recipe):
version = "3.11.6"
version = "3.12.6"
url = "https://www.python.org/ftp/python/{version}/Python-{version}.tgz"
depends = ["hostpython3", "libffi", "openssl"]
library = "libpython3.11.a"
library = "libpython3.12.a"
pbx_libraries = ["libz", "libbz2", "libsqlite3"]

def init_with_ctx(self, ctx):
super().init_with_ctx(ctx)
self.set_python(self, "3.11")
ctx.python_ver_dir = "python3.11"
self.set_python(self, "3.12")
ctx.python_ver_dir = "python3.12"
ctx.python_prefix = join(ctx.dist_dir, "root", "python3")
ctx.site_packages_dir = join(
ctx.python_prefix, "lib", ctx.python_ver_dir, "site-packages")
Expand Down Expand Up @@ -135,9 +135,9 @@ def reduce_python(self):
# platform binaries and configuration
with cd(join(
self.ctx.dist_dir, "root", "python3", "lib",
"python3.11", "config-3.11-darwin")):
"python3.12", "config-3.12-darwin")):
sh.rm(
"libpython3.11.a",
"libpython3.12.a",
"python.o",
"config.c.in",
"makesetup",
Expand All @@ -146,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.11.a")
sh.rm("-rf", "pkgconfig", "libpython3.12.a")

# cleanup python libraries
with cd(join(
self.ctx.dist_dir, "root", "python3", "lib", "python3.11")):
self.ctx.dist_dir, "root", "python3", "lib", "python3.12")):
sh.rm("-rf", "wsgiref", "curses", "idlelib", "lib2to3",
"ensurepip", "turtledemo", "lib-dynload", "venv",
"pydoc_data")
Expand All @@ -171,12 +171,12 @@ def reduce_python(self):
sh.find(".", "-name", "__pycache__", "-type", "d", "-delete")

# create the lib zip
logger.info("Create a python3.11.zip")
sh.mv("config-3.11-darwin", "..")
logger.info("Create a python3.12.zip")
sh.mv("config-3.12-darwin", "..")
sh.mv("site-packages", "..")
sh.zip("-r", "../python311.zip", sh.glob("*"))
sh.rm("-rf", sh.glob("*"))
sh.mv("../config-3.11-darwin", ".")
sh.mv("../config-3.12-darwin", ".")
sh.mv("../site-packages", ".")


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.11/:%@/lib/python3.11/site-packages:.", resourcePath, resourcePath, resourcePath, nil];
NSString *python_path = [NSString stringWithFormat:@"PYTHONPATH=%@:%@/lib/python3.12/:%@/lib/python3.12/site-packages:.", resourcePath, resourcePath, resourcePath, nil];
putenv((char *)[python_path UTF8String]);

NSString *tmp_path = [NSString stringWithFormat:@"TMP=%@/tmp", resourcePath, nil];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.11/**",
"{{ cookiecutter.dist_dir }}/root/python3/include/python3.12/**",
"{{ cookiecutter.dist_dir }}/include/common/sdl2",
);
INFOPLIST_FILE = "{{ cookiecutter.project_name }}-Info.plist";
Expand Down Expand Up @@ -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.11/**",
"{{ cookiecutter.dist_dir }}/root/python3/include/python3.12/**",
"{{ cookiecutter.dist_dir }}/include/common/sdl2",
);
INFOPLIST_FILE = "{{ cookiecutter.project_name }}-Info.plist";
Expand Down

0 comments on commit ada65c9

Please sign in to comment.