Update to python 3.8.2 (#443)

* bump python version to 3.8.2

* Revert to cython 0.28.1
This commit is contained in:
Mirko 2020-04-25 20:12:59 +02:00 committed by GitHub
parent 64bd692632
commit 9bb9efe0f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 289 additions and 269 deletions

View file

@ -34,7 +34,7 @@ jobs:
pip3 install sh pip3 install sh
brew install autoconf automake libtool pkg-config brew install autoconf automake libtool pkg-config
brew link libtool brew link libtool
pip3 install Cython==0.29.10 pip3 install Cython==0.28.1
- name: Build updated recipes - name: Build updated recipes
run: | run: |
python3 .ci/rebuild_updated_recipes.py python3 .ci/rebuild_updated_recipes.py

View file

@ -20,7 +20,7 @@ class HostSetuptools3(Recipe):
# Setuptools version 28.3.0 # Setuptools version 28.3.0
site_packages_path = join( site_packages_path = join(
self.ctx.dist_dir, 'hostpython3', self.ctx.dist_dir, 'hostpython3',
'lib', 'python3.7', 'site-packages') 'lib', 'python3.8', 'site-packages')
os.chdir(site_packages_path) os.chdir(site_packages_path)
with open('setuptools.pth', 'r') as f: with open('setuptools.pth', 'r') as f:
setuptools_egg_path = f.read().strip('./').strip('\n') setuptools_egg_path = f.read().strip('./').strip('\n')

View file

@ -0,0 +1,39 @@
from toolchain import Recipe, shprint
from os.path import join
import sh
import logging
logger = logging.getLogger(__name__)
class HostOpensslRecipe(Recipe):
version = "1.1.1f"
url = "http://www.openssl.org/source/openssl-{version}.tar.gz"
archs = ["x86_64"]
def get_build_env(self):
build_env = self.ctx.env.copy()
self.build_env_x86_84 = build_env
return build_env
def build_x86_64(self):
build_env = self.get_build_env()
configure = sh.Command(join(self.build_dir, "Configure"))
shprint(configure,
"darwin64-x86_64-cc",
_env=build_env)
shprint(sh.make, "clean")
shprint(sh.make, self.ctx.concurrent_make, "build_libs")
def install(self):
sh.mkdir('-p', join(self.ctx.dist_dir, 'hostopenssl'))
sh.cp('-r', join(self.get_build_dir('x86_64'), 'include'),
join(self.ctx.dist_dir, 'hostopenssl', 'include'))
sh.mkdir('-p', join(self.ctx.dist_dir, 'hostopenssl', 'lib'))
sh.cp(join(self.get_build_dir('x86_64'), 'libssl.a'),
join(self.ctx.dist_dir, 'hostopenssl', 'lib'))
sh.cp(join(self.get_build_dir('x86_64'), 'libcrypto.a'),
join(self.ctx.dist_dir, 'hostopenssl', 'lib'))
recipe = HostOpensslRecipe()

View file

@ -1,5 +1,5 @@
from toolchain import Recipe, shprint, ensure_dir from toolchain import Recipe, shprint
from os.path import join, exists from os.path import join
import os import os
import sh import sh
import shutil import shutil
@ -9,16 +9,16 @@ logger = logging.getLogger(__name__)
class Hostpython3Recipe(Recipe): class Hostpython3Recipe(Recipe):
version = "3.7.1" version = "3.8.2"
url = "https://www.python.org/ftp/python/{version}/Python-{version}.tgz" url = "https://www.python.org/ftp/python/{version}/Python-{version}.tgz"
depends = [] depends = ["hostlibffi", "hostopenssl"]
optional_depends = ["openssl"] optional_depends = []
archs = ["x86_64"] archs = ["x86_64"]
def init_with_ctx(self, ctx): def init_with_ctx(self, ctx):
super(Hostpython3Recipe, self).init_with_ctx(ctx) super(Hostpython3Recipe, self).init_with_ctx(ctx)
self.set_hostpython(self, "3.7") self.set_hostpython(self, "3.8")
self.ctx.so_suffix = ".cpython-37m-darwin.so" self.ctx.so_suffix = ".cpython-38m-darwin.so"
self.ctx.hostpython = join(self.ctx.dist_dir, "hostpython3", "bin", "python") self.ctx.hostpython = join(self.ctx.dist_dir, "hostpython3", "bin", "python")
self.ctx.hostpgen = join(self.ctx.dist_dir, "hostpython3", "bin", "pgen") self.ctx.hostpgen = join(self.ctx.dist_dir, "hostpython3", "bin", "pgen")
logger.info("Global: hostpython located at {}".format(self.ctx.hostpython)) logger.info("Global: hostpython located at {}".format(self.ctx.hostpython))
@ -28,33 +28,10 @@ class Hostpython3Recipe(Recipe):
if self.has_marker("patched"): if self.has_marker("patched"):
return return
self.copy_file("ModulesSetup", "Modules/Setup.local") self.copy_file("ModulesSetup", "Modules/Setup.local")
# self.apply_patch("ssize-t-max.patch")
# self.apply_patch("dynload.patch")
# self.apply_patch("static-_sqlite3.patch")
# shutil.copy("Modules/Setup.dist", "Modules/Setup")
# if "openssl.build_all" in self.ctx.state:
# self.append_file("ModulesSetup.openssl", "Modules/Setup.local")
self.set_marker("patched") self.set_marker("patched")
def postbuild_arch(self, arch): def postbuild_arch(self, arch):
return return
"""
makefile_fn = join(self.build_dir, "Makefile")
with open(makefile_fn) as fd:
lines = fd.readlines()
for index, line in enumerate(lines):
if "-bundle" not in line:
continue
parts = line.split(" ")
parts.remove("-bundle")
if "-bundle_loader" in parts:
i = parts.index("-bundle_loader")
parts.pop(i)
parts.pop(i)
lines[index] = " ".join(parts)
with open(makefile_fn, "w") as fd:
fd.writelines(lines)
"""
def get_build_env(self): def get_build_env(self):
sdk_path = sh.xcrun("--sdk", "macosx", "--show-sdk-path").strip() sdk_path = sh.xcrun("--sdk", "macosx", "--show-sdk-path").strip()
@ -73,10 +50,6 @@ class Hostpython3Recipe(Recipe):
"-mmacosx-version-min=10.12", "-mmacosx-version-min=10.12",
"-I{}".format(join(self.ctx.dist_dir, "hostlibffi", "usr", "local", "include")) "-I{}".format(join(self.ctx.dist_dir, "hostlibffi", "usr", "local", "include"))
]) ])
if "openssl.build_all" in self.ctx.state:
build_env["LDFLAGS"] += " -L{}".format(join(self.ctx.dist_dir, "lib"))
build_env["CFLAGS"] += " -I{}".format(join(self.ctx.dist_dir, "include",
"x86_64", "openssl"))
return build_env return build_env
def build_x86_64(self): def build_x86_64(self):
@ -84,41 +57,33 @@ class Hostpython3Recipe(Recipe):
configure = sh.Command(join(self.build_dir, "configure")) configure = sh.Command(join(self.build_dir, "configure"))
shprint(configure, shprint(configure,
"--prefix={}".format(join(self.ctx.dist_dir, "hostpython3")), "--prefix={}".format(join(self.ctx.dist_dir, "hostpython3")),
# "--disable-toolbox-glue", "--with-openssl={}".format(join(self.ctx.dist_dir, 'hostopenssl')),
# "--without-gcc",
_env=build_env) _env=build_env)
shprint(sh.make, "-C", self.build_dir, self.ctx.concurrent_make, shprint(sh.make, "-C", self.build_dir, self.ctx.concurrent_make,
_env=build_env) _env=build_env)
# shutil.move("python", "hostpython")
# shutil.move("Parser/pgen", "Parser/hostpgen")
def install(self): def install(self):
arch = list(self.filtered_archs)[0] arch = list(self.filtered_archs)[0]
build_env = self.get_build_env() build_env = self.get_build_env()
build_dir = self.get_build_dir(arch.arch) build_dir = self.get_build_dir(arch.arch)
build_env["PATH"] = os.environ["PATH"] build_env["PATH"] = os.environ["PATH"]
# Compiling sometimes looks for Python-ast.py in the 'Python' i.s.o.
# the 'hostpython' folder. Create a symlink to fix. See issue #201
# shprint(sh.ln, "-s",
# join(build_dir, "hostpython3"),
# join(build_dir, "Python"))
shprint(sh.make, self.ctx.concurrent_make, shprint(sh.make, self.ctx.concurrent_make,
"-C", build_dir, "-C", build_dir,
"install", "install",
_env=build_env) _env=build_env)
# pylib_dir = join(self.ctx.dist_dir, "hostpython3", "lib", "python3.7")
# if exists(pylib_dir):
# shutil.rmtree(pylib_dir)
# shutil.copytree(
# join(build_dir, "Lib"),
# pylib_dir)
# ensure_dir(join(pylib_dir, "config"))
# shutil.copy(
# join(build_dir, "Makefile"),
# join(pylib_dir, "config", "Makefile"))
shutil.copy( shutil.copy(
join(self.ctx.dist_dir, "hostpython3", "bin", "python3"), join(self.ctx.dist_dir, "hostpython3", "bin", "python3"),
join(self.ctx.dist_dir, "hostpython3", "bin", "python")) join(self.ctx.dist_dir, "hostpython3", "bin", "python"))
"""
I don't like this kind of "patches".
sysconfig was overriding our cflags and extensions were failing to build.
This hack resets the cflags provided by sysconfig.
"""
with open(join(self.ctx.dist_dir, "hostpython3", "lib", "python3.8", "distutils", "sysconfig.py"), 'r') as sysconfigfile:
lines = sysconfigfile.readlines()
lines[192] = ' cflags = ""\n'
with open(join(self.ctx.dist_dir, "hostpython3", "lib", "python3.8", "distutils", "sysconfig.py"), 'w') as sysconfigfile:
sysconfigfile.writelines(lines)
recipe = Hostpython3Recipe() recipe = Hostpython3Recipe()

View file

@ -9,8 +9,13 @@ logger = logging.getLogger(__name__)
class KivyRecipe(CythonRecipe): class KivyRecipe(CythonRecipe):
# post kivy 1.11.1, including statusbar/fullscreen fix """
version = "38fcbd5b90c99a96d82682f14986836cde81412d" post kivy 2.0.0rc1
Includes these iOS specific fixes:
- Statusbar / Fullscreen fix (PR #4589)
- Extend usage of certifi on iOS (PR #4648)
"""
version = "067064c23a275187e67f1c9d7de7cc06f384af4d"
url = "https://github.com/kivy/kivy/archive/{version}.zip" url = "https://github.com/kivy/kivy/archive/{version}.zip"
library = "libkivy.a" library = "libkivy.a"
depends = ["sdl2", "sdl2_image", "sdl2_mixer", "sdl2_ttf", "ios", depends = ["sdl2", "sdl2_image", "sdl2_mixer", "sdl2_ttf", "ios",

View file

@ -68,7 +68,7 @@ zlib zlibmodule.c -I$(prefix)/include -lz
##################################################################### #####################################################################
_ctypes_test _ctypes/_ctypes_test.c _ctypes_test _ctypes/_ctypes_test.c
_testbuffer _testbuffer.c _testbuffer _testbuffer.c
_testcapi _testcapimodule.c _testinternalcapi _testinternalcapi.c
_testimportmultiple _testimportmultiple.c _testimportmultiple _testimportmultiple.c
##################################################################### #####################################################################

View file

@ -9,16 +9,16 @@ logger = logging.getLogger(__name__)
class Python3Recipe(Recipe): class Python3Recipe(Recipe):
version = "3.7.1" version = "3.8.2"
url = "https://www.python.org/ftp/python/{version}/Python-{version}.tgz" url = "https://www.python.org/ftp/python/{version}/Python-{version}.tgz"
depends = ["hostpython3", "libffi", "openssl"] depends = ["hostpython3", "libffi", "openssl"]
library = "libpython3.7m.a" library = "libpython3.8.a"
pbx_libraries = ["libz", "libbz2", "libsqlite3"] pbx_libraries = ["libz", "libbz2", "libsqlite3"]
def init_with_ctx(self, ctx): def init_with_ctx(self, ctx):
super(Python3Recipe, self).init_with_ctx(ctx) super(Python3Recipe, self).init_with_ctx(ctx)
self.set_python(self, "3.7") self.set_python(self, "3.8")
ctx.python_ver_dir = "python3.7" ctx.python_ver_dir = "python3.8"
ctx.python_prefix = join(ctx.dist_dir, "root", "python3") ctx.python_prefix = join(ctx.dist_dir, "root", "python3")
ctx.site_packages_dir = join( ctx.site_packages_dir = join(
ctx.python_prefix, "lib", ctx.python_ver_dir, "site-packages") ctx.python_prefix, "lib", ctx.python_ver_dir, "site-packages")
@ -27,10 +27,13 @@ class Python3Recipe(Recipe):
# common to all archs # common to all archs
if self.has_marker("patched"): if self.has_marker("patched"):
return return
self.apply_patch("dynload.patch") self.apply_patch("config.sub.patch")
self.apply_patch("configure.patch")
self.apply_patch("posixmodule.patch")
self.apply_patch("dynload_shlib.patch")
self.apply_patch("disable_explicit_blake2.patch")
self.copy_file("ModulesSetup", "Modules/Setup.local") self.copy_file("ModulesSetup", "Modules/Setup.local")
self.append_file("ModulesSetup.mobile", "Modules/Setup.local") self.append_file("ModulesSetup.mobile", "Modules/Setup.local")
self.apply_patch("xcompile.patch")
self.set_marker("patched") self.set_marker("patched")
def postbuild_arch(self, arch): def postbuild_arch(self, arch):
@ -40,7 +43,7 @@ class Python3Recipe(Recipe):
py_arch = "arm" py_arch = "arm"
elif py_arch == "arm64": elif py_arch == "arm64":
py_arch = "aarch64" py_arch = "aarch64"
tmp_folder = "temp.ios-{}-3.7{}".format(py_arch, self.build_dir) tmp_folder = "temp.ios-{}-3.8{}".format(py_arch, self.build_dir)
build_env = self.get_build_env(arch) build_env = self.get_build_env(arch)
for o_file in [ for o_file in [
"cache.o", "cache.o",
@ -81,7 +84,6 @@ class Python3Recipe(Recipe):
"LD={}".format(build_env["LD"]), "LD={}".format(build_env["LD"]),
"CFLAGS={}".format(build_env["CFLAGS"]), "CFLAGS={}".format(build_env["CFLAGS"]),
"LDFLAGS={} -undefined dynamic_lookup".format(build_env["LDFLAGS"]), "LDFLAGS={} -undefined dynamic_lookup".format(build_env["LDFLAGS"]),
# "--without-pymalloc",
"ac_cv_file__dev_ptmx=yes", "ac_cv_file__dev_ptmx=yes",
"ac_cv_file__dev_ptc=no", "ac_cv_file__dev_ptc=no",
"ac_cv_little_endian_double=yes", "ac_cv_little_endian_double=yes",
@ -114,10 +116,13 @@ class Python3Recipe(Recipe):
"--prefix={}".format(prefix), "--prefix={}".format(prefix),
"--without-ensurepip", "--without-ensurepip",
"--with-system-ffi", "--with-system-ffi",
# "--without-doc-strings",
"--enable-ipv6", "--enable-ipv6",
"PYTHON_FOR_BUILD=_PYTHON_PROJECT_BASE=$(abs_builddir) \
_PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) \
PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib\
_PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH)\
{}".format(sh.Command(self.ctx.hostpython)),
_env=build_env) _env=build_env)
self.apply_patch("ctypes_duplicate.patch") self.apply_patch("ctypes_duplicate.patch")
shprint(sh.make, self.ctx.concurrent_make) shprint(sh.make, self.ctx.concurrent_make)
@ -130,7 +135,6 @@ class Python3Recipe(Recipe):
"install", "install",
"prefix={}".format(join(self.ctx.dist_dir, "root", "python3")), "prefix={}".format(join(self.ctx.dist_dir, "root", "python3")),
_env=build_env) _env=build_env)
# os.execve("/bin/bash", ["/bin/bash"], os.environ)
self.reduce_python() self.reduce_python()
self.install_mock_modules() self.install_mock_modules()
@ -138,7 +142,7 @@ class Python3Recipe(Recipe):
logger.info("Install mock modules") logger.info("Install mock modules")
sqlite3_src = join(self.recipe_dir, 'mock_modules', '_sqlite3') sqlite3_src = join(self.recipe_dir, 'mock_modules', '_sqlite3')
site_packages_folder = join( site_packages_folder = join(
self.ctx.dist_dir, "root", "python3", "lib", "python3.7", "site-packages", "_sqlite3") self.ctx.dist_dir, "root", "python3", "lib", "python3.8", "site-packages", "_sqlite3")
shutil.rmtree(site_packages_folder, ignore_errors=True) # Needed in case of rebuild shutil.rmtree(site_packages_folder, ignore_errors=True) # Needed in case of rebuild
shutil.copytree(sqlite3_src, site_packages_folder) shutil.copytree(sqlite3_src, site_packages_folder)
@ -148,14 +152,12 @@ class Python3Recipe(Recipe):
try: try:
logger.info("Remove files unlikely to be used") logger.info("Remove files unlikely to be used")
os.chdir(join(self.ctx.dist_dir, "root", "python3")) os.chdir(join(self.ctx.dist_dir, "root", "python3"))
# os.execve("/bin/bash", ["/bin/bash"], env=os.environ)
sh.rm("-rf", "bin", "share") sh.rm("-rf", "bin", "share")
# platform binaries and configuration # platform binaries and configuration
os.chdir(join( os.chdir(join(
self.ctx.dist_dir, "root", "python3", "lib", self.ctx.dist_dir, "root", "python3", "lib",
"python3.7", "config-3.7m-darwin")) "python3.8", "config-3.8-darwin"))
sh.rm("libpython3.7m.a") sh.rm("libpython3.8.a")
sh.rm("python.o") sh.rm("python.o")
sh.rm("config.c.in") sh.rm("config.c.in")
sh.rm("makesetup") sh.rm("makesetup")
@ -164,11 +166,11 @@ class Python3Recipe(Recipe):
# cleanup pkgconfig and compiled lib # cleanup pkgconfig and compiled lib
os.chdir(join(self.ctx.dist_dir, "root", "python3", "lib")) os.chdir(join(self.ctx.dist_dir, "root", "python3", "lib"))
sh.rm("-rf", "pkgconfig") sh.rm("-rf", "pkgconfig")
sh.rm("-f", "libpython3.7m.a") sh.rm("-f", "libpython3.8.a")
# cleanup python libraries # cleanup python libraries
os.chdir(join( os.chdir(join(
self.ctx.dist_dir, "root", "python3", "lib", "python3.7")) self.ctx.dist_dir, "root", "python3", "lib", "python3.8"))
sh.rm("-rf", "wsgiref", "curses", "idlelib", "lib2to3", sh.rm("-rf", "wsgiref", "curses", "idlelib", "lib2to3",
"ensurepip", "turtledemo", "lib-dynload", "venv", "ensurepip", "turtledemo", "lib-dynload", "venv",
"pydoc_data") "pydoc_data")
@ -189,12 +191,12 @@ class Python3Recipe(Recipe):
sh.find(".", "-name", "__pycache__", "-type", "d", "-delete") sh.find(".", "-name", "__pycache__", "-type", "d", "-delete")
# create the lib zip # create the lib zip
logger.info("Create a python3.7.zip") logger.info("Create a python3.8.zip")
sh.mv("config-3.7m-darwin", "..") sh.mv("config-3.8-darwin", "..")
sh.mv("site-packages", "..") sh.mv("site-packages", "..")
sh.zip("-r", "../python37.zip", sh.glob("*")) sh.zip("-r", "../python38.zip", sh.glob("*"))
sh.rm("-rf", sh.glob("*")) sh.rm("-rf", sh.glob("*"))
sh.mv("../config-3.7m-darwin", ".") sh.mv("../config-3.8-darwin", ".")
sh.mv("../site-packages", ".") sh.mv("../site-packages", ".")
finally: finally:
os.chdir(oldpwd) os.chdir(oldpwd)

View file

@ -0,0 +1,31 @@
diff -Naur Python-3.8.2.orig/.building Python-3.8.2/.building
--- Python-3.8.2.orig/.building 2020-04-11 23:53:30.000000000 +0200
+++ Python-3.8.2/.building 1970-01-01 01:00:00.000000000 +0100
@@ -1 +0,0 @@
-ok
\ No newline at end of file
diff -Naur Python-3.8.2.orig/config.sub Python-3.8.2/config.sub
--- Python-3.8.2.orig/config.sub 2020-04-11 23:53:40.000000000 +0200
+++ Python-3.8.2/config.sub 2020-04-11 23:51:41.000000000 +0200
@@ -249,7 +249,7 @@
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| am33_2.0 \
| arc | arceb \
- | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv6m | armv[78][arm] \
+ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv6m | armv[78][armk] \
| avr | avr32 \
| ba \
| be32 | be64 \
@@ -1524,7 +1524,11 @@
;;
-nacl*)
;;
- -ios)
+ -ios*)
+ ;;
+ -tvos*)
+ ;;
+ -watchos*)
;;
-none)
;;

View file

@ -0,0 +1,90 @@
diff -Naur Python-3.8.2.orig/configure Python-3.8.2/configure
--- Python-3.8.2.orig/configure 2020-04-12 00:00:42.000000000 +0200
+++ Python-3.8.2/configure 2020-04-12 00:08:45.000000000 +0200
@@ -3271,6 +3271,15 @@
*-*-cygwin*)
ac_sys_system=Cygwin
;;
+ *-apple-ios)
+ ac_sys_system=iOS
+ ;;
+ *-apple-tvos)
+ ac_sys_system=tvOS
+ ;;
+ *-apple-watchos)
+ ac_sys_system=watchOS
+ ;;
*-*-vxworks*)
ac_sys_system=VxWorks
;;
@@ -3318,6 +3327,15 @@
_host_cpu=$host_cpu
esac
;;
+ *-apple-*)
+ case "$host_cpu" in
+ arm*)
+ _host_cpu=arm
+ ;;
+ *)
+ _host_cpu=$host_cpu
+ esac
+ ;;
*-*-cygwin*)
_host_cpu=
;;
@@ -3396,6 +3414,13 @@
define_xopen_source=no;;
Darwin/1[0-9].*)
define_xopen_source=no;;
+ # On iOS, defining _POSIX_C_SOURCE also disables platform specific features.
+ iOS/*)
+ define_xopen_source=no;;
+ tvOS/*)
+ define_xopen_source=no;;
+ watchOS/*)
+ define_xopen_source=no;;
# On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but
# used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined
# or has another value. By not (re)defining it, the defaults come in place.
@@ -6165,10 +6190,16 @@
fi
if test "$cross_compiling" = yes; then
- case "$READELF" in
- readelf|:)
- as_fn_error $? "readelf for the host is required for cross builds" "$LINENO" 5
- ;;
+ case "$host" in
+ *-apple-*os)
+ # readelf not required for iOS cross builds.
+ ;;
+ *)
+ case "$READELF" in
+ readelf|:)
+ as_fn_error $? "readelf for the host is required for cross builds" "$LINENO" 5
+ ;;
+ esac
esac
fi
@@ -6920,8 +6951,6 @@
# tweak BASECFLAGS based on compiler and platform
case $GCC in
yes)
- CFLAGS_NODIST="$CFLAGS_NODIST -std=c99"
-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -Wextra" >&5
$as_echo_n "checking for -Wextra... " >&6; }
ac_save_cc="$CC"
@@ -11438,6 +11467,10 @@
;;
hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
+ # Dynamic loading on iOS
+ iOS/*) DYNLOADFILE="dynload_shlib.o";;
+ tvOS/*) DYNLOADFILE="dynload_shlib.o";;
+ watchOS/*) DYNLOADFILE="dynload_shlib.o";;
*)
# use dynload_shlib.c and dlopen() if we have it; otherwise stub
# out any dynamic loading
if test "$ac_cv_func_dlopen" = yes

View file

@ -1,17 +1,19 @@
--- Python-3.7.1/Modules/_ctypes/cfield.c-old 2018-11-03 13:47:40.000000000 +0100 diff -Naur Python-3.8.2.orig/Modules/_ctypes/cfield.c Python-3.8.2/Modules/_ctypes/cfield.c
+++ Python-3.7.1/Modules/_ctypes/cfield.c 2018-11-03 13:48:14.000000000 +0100 --- Python-3.8.2.orig/Modules/_ctypes/cfield.c 2020-04-13 12:23:46.000000000 +0200
@@ -1633,6 +1633,7 @@ +++ 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; } ffi_type;
*/ */
-
+#if 0 +#if 0
/* align and size are bogus for void, but they must not be zero */ /* align and size are bogus for void, but they must not be zero */
ffi_type ffi_type_void = { 1, 1, FFI_TYPE_VOID }; ffi_type ffi_type_void = { 1, 1, FFI_TYPE_VOID };
@@ -1660,4 +1661,6 @@ @@ -1663,5 +1663,5 @@
FFI_TYPE_LONGDOUBLE };
ffi_type ffi_type_pointer = { sizeof(void *), VOID_P_ALIGN, FFI_TYPE_POINTER }; ffi_type ffi_type_pointer = { sizeof(void *), VOID_P_ALIGN, FFI_TYPE_POINTER };
-
+#endif +#endif
+
/*---------------- EOF ----------------*/ /*---------------- EOF ----------------*/

View file

@ -0,0 +1,12 @@
diff -Naur Python-3.8.2.orig/Modules/_blake2/impl/blake2-impl.h Python-3.8.2/Modules/_blake2/impl/blake2-impl.h
--- Python-3.8.2.orig/Modules/_blake2/impl/blake2-impl.h 2020-04-12 01:20:03.000000000 +0200
+++ Python-3.8.2/Modules/_blake2/impl/blake2-impl.h 2020-04-12 01:21:11.000000000 +0200
@@ -26,6 +26,8 @@
#define BLAKE2_IMPL_EVAL(x,y) BLAKE2_IMPL_CAT(x,y)
#define BLAKE2_IMPL_NAME(fun) BLAKE2_IMPL_EVAL(fun, SUFFIX)
+#undef HAVE_EXPLICIT_BZERO
+#undef HAVE_EXPLICIT_MEMSET
static inline uint32_t load32( const void *src )
{
#if defined(NATIVE_LITTLE_ENDIAN)

View file

@ -1,9 +1,10 @@
--- Python-3.7.1/Python/dynload_shlib.c 2018-10-20 08:04:19.000000000 +0200 diff -Naur Python-3.8.2.orig/Python/dynload_shlib.c Python-3.8.2/Python/dynload_shlib.c
+++ Python-3.7.1/Python/dynload_shlib.c 2018-11-02 14:23:15.000000000 +0100 --- Python-3.8.2.orig/Python/dynload_shlib.c 2020-04-12 00:17:24.000000000 +0200
@@ -72,6 +72,16 @@ +++ Python-3.8.2/Python/dynload_shlib.c 2020-04-12 00:20:10.000000000 +0200
@@ -74,6 +74,15 @@
PyOS_snprintf(funcname, sizeof(funcname), PyOS_snprintf(funcname, sizeof(funcname),
LEAD_UNDERSCORE "%.20s_%.200s", prefix, shortname); LEAD_UNDERSCORE "%.20s_%.200s", prefix, shortname);
+ /* On IOS, dlopen crash as soon as we try to open one of our library. + /* On IOS, dlopen crash as soon as we try to open one of our library.
+ * Instead, we have done a redirection of linking to convert our .so into a + * Instead, we have done a redirection of linking to convert our .so into a
+ * .a. Then the main executable is linked with theses symbol. So, instead + * .a. Then the main executable is linked with theses symbol. So, instead
@ -13,11 +14,10 @@
+ return (dl_funcptr) dlsym(RTLD_SELF, funcname); + return (dl_funcptr) dlsym(RTLD_SELF, funcname);
+ +
+ #if 0 + #if 0
+
if (fp != NULL) { if (fp != NULL) {
int i; int i;
struct _Py_stat_struct status; @@ -129,4 +138,5 @@
@@ -126,4 +136,5 @@
handles[nhandles++].handle = handle; handles[nhandles++].handle = handle;
p = (dl_funcptr) dlsym(handle, funcname); p = (dl_funcptr) dlsym(handle, funcname);
return p; return p;

View file

@ -1,10 +0,0 @@
"""
def __bootstrap__():
global __bootstrap__, __loader__, __file__
import sys, pkg_resources, imp
__file__ = pkg_resources.resource_filename(__name__, '_sqlite3.cpython-37m-darwin.so')
__loader__ = None; del __bootstrap__, __loader__
print("demo")
imp.load_dynamic(__name__,__file__)
__bootstrap__()
"""

View file

@ -0,0 +1,31 @@
diff -Naur Python-3.8.2.orig/Modules/posixmodule.c Python-3.8.2/Modules/posixmodule.c
--- Python-3.8.2.orig/Modules/posixmodule.c 2020-04-12 00:11:47.000000000 +0200
+++ Python-3.8.2/Modules/posixmodule.c 2020-04-12 00:13:21.000000000 +0200
@@ -216,6 +216,27 @@
#endif /* _MSC_VER */
#endif /* ! __WATCOMC__ || __QNX__ */
+// iOS
+#undef HAVE_EXECV
+#undef HAVE_FORK
+#undef HAVE_FORK1
+#undef HAVE_FORKPTY
+#undef HAVE_GETGROUPS
+#undef HAVE_SCHED_H
+#undef HAVE_SENDFILE
+#undef HAVE_SETPRIORITY
+#undef HAVE_SPAWNV
+#undef HAVE_WAIT
+#undef HAVE_WAIT3
+#undef HAVE_WAIT4
+#undef HAVE_WAITPID
+#undef HAVE_SYSTEM
+#undef HAVE_FEXECVE
+#undef HAVE_RTPSPAWN
+#undef HAVE_POSIX_SPAWN
+#undef HAVE_POSIX_SPAWNP
+#undef HAVE_FDWALK
+#undef HAVE_COPY_FILE_RANGE
/*[clinic input]
# one of the few times we lie about this name!

View file

@ -1,145 +0,0 @@
--- Python-3.7.1.orig/config.sub 2018-10-20 08:04:19.000000000 +0200
+++ Python-3.7.1/config.sub 2018-10-31 13:31:22.000000000 +0100
@@ -249,7 +249,7 @@
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| am33_2.0 \
| arc | arceb \
- | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv6m | armv[78][arm] \
+ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv6m | armv[78][armk] \
| avr | avr32 \
| ba \
| be32 | be64 \
@@ -1524,7 +1524,11 @@
;;
-nacl*)
;;
- -ios)
+ -ios*)
+ ;;
+ -tvos*)
+ ;;
+ -watchos*)
;;
-none)
;;
--- Python-3.7.1.orig/configure 2018-10-20 08:04:19.000000000 +0200
+++ Python-3.7.1/configure 2018-10-31 13:41:38.000000000 +0100
@@ -3253,6 +3253,15 @@
*-*-cygwin*)
ac_sys_system=Cygwin
;;
+ *-apple-ios)
+ ac_sys_system=iOS
+ ;;
+ *-apple-tvos)
+ ac_sys_system=tvOS
+ ;;
+ *-apple-watchos)
+ ac_sys_system=watchOS
+ ;;
*)
# for now, limit cross builds to known configurations
MACHDEP="unknown"
@@ -3294,6 +3303,15 @@
_host_cpu=$host_cpu
esac
;;
+ *-apple-*)
+ case "$host_cpu" in
+ arm*)
+ _host_cpu=arm
+ ;;
+ *)
+ _host_cpu=$host_cpu
+ esac
+ ;;
*-*-cygwin*)
_host_cpu=
;;
@@ -3369,6 +3387,13 @@
define_xopen_source=no;;
Darwin/1[0-9].*)
define_xopen_source=no;;
+ # On iOS, defining _POSIX_C_SOURCE also disables platform specific features.
+ iOS/*)
+ define_xopen_source=no;;
+ tvOS/*)
+ define_xopen_source=no;;
+ watchOS/*)
+ define_xopen_source=no;;
# On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but
# used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined
# or has another value. By not (re)defining it, the defaults come in place.
@@ -6176,11 +6201,17 @@
fi
if test "$cross_compiling" = yes; then
- case "$READELF" in
- readelf|:)
- as_fn_error $? "readelf for the host is required for cross builds" "$LINENO" 5
- ;;
- esac
+ case "$host" in
+ *-apple-*os)
+ # readelf not required for iOS cross builds.
+ ;;
+ *)
+ case "$READELF" in
+ readelf|:)
+ as_fn_error $? "readelf for the host is required for cross builds" "$LINENO" 5
+ ;;
+ esac
+ esac
fi
@@ -6803,8 +6834,6 @@
# tweak BASECFLAGS based on compiler and platform
case $GCC in
yes)
- CFLAGS_NODIST="$CFLAGS_NODIST -std=c99"
-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -Wextra" >&5
$as_echo_n "checking for -Wextra... " >&6; }
ac_save_cc="$CC"
@@ -11281,6 +11310,10 @@
fi
;;
hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
+ # Dynamic loading on iOS
+ iOS/*) DYNLOADFILE="dynload_shlib.o";;
+ tvOS/*) DYNLOADFILE="dynload_shlib.o";;
+ watchOS/*) DYNLOADFILE="dynload_shlib.o";;
*)
# use dynload_shlib.c and dlopen() if we have it; otherwise stub
# out any dynamic loading
@@ -18383,4 +18416,3 @@
echo "" >&6
echo "" >&6
fi
-
--- Python-3.7.1.orig/Modules/posixmodule.c 2018-10-20 08:04:19.000000000 +0200
+++ Python-3.7.1/Modules/posixmodule.c 2018-10-31 15:00:14.000000000 +0100
@@ -194,6 +194,22 @@
#endif /* _MSC_VER */
#endif /* ! __WATCOMC__ || __QNX__ */
+// iOS
+#undef HAVE_EXECV
+#undef HAVE_FORK
+#undef HAVE_FORK1
+#undef HAVE_FORKPTY
+#undef HAVE_GETGROUPS
+#undef HAVE_SCHED_H
+#undef HAVE_SENDFILE
+#undef HAVE_SETPRIORITY
+#undef HAVE_SPAWNV
+#undef HAVE_WAIT
+#undef HAVE_WAIT3
+#undef HAVE_WAIT4
+#undef HAVE_WAITPID
+#undef HAVE_SYSTEM
+#undef HAVE_FEXECVE
/*[clinic input]
# one of the few times we lie about this name!

View file

@ -1093,6 +1093,7 @@ class CythonRecipe(PythonRecipe):
env = super(CythonRecipe, self).get_recipe_env(arch) env = super(CythonRecipe, self).get_recipe_env(arch)
env["KIVYIOSROOT"] = self.ctx.root_dir env["KIVYIOSROOT"] = self.ctx.root_dir
env["IOSSDKROOT"] = arch.sysroot env["IOSSDKROOT"] = arch.sysroot
env["CUSTOMIZED_OSX_COMPILER"] = 'True'
env["LDSHARED"] = join(self.ctx.root_dir, "tools", "liblink") env["LDSHARED"] = join(self.ctx.root_dir, "tools", "liblink")
env["ARM_LD"] = env["LD"] env["ARM_LD"] = env["LD"]
env["ARCH"] = arch.arch env["ARCH"] = arch.arch
@ -1475,9 +1476,9 @@ Xcode:
print("env ({}): {}".format(arch, pformat(env))) print("env ({}): {}".format(arch, pformat(env)))
def pip3(self): def pip3(self):
self.pip(pip_version="pip3") self.pip()
def pip(self, pip_version="pip"): def pip(self):
ctx = Context() ctx = Context()
for recipe in Recipe.list_recipes(): for recipe in Recipe.list_recipes():
key = "{}.build_all".format(recipe) key = "{}.build_all".format(recipe)
@ -1496,7 +1497,7 @@ Xcode:
"PYTHONOPTIMIZE": "2", "PYTHONOPTIMIZE": "2",
# "PIP_INSTALL_TARGET": ctx.site_packages_dir # "PIP_INSTALL_TARGET": ctx.site_packages_dir
} }
pip_path = sh.which(pip_version) pip_path = join(ctx.dist_dir, 'hostpython3', 'bin', 'pip3')
pip_args = [] pip_args = []
if len(sys.argv) > 2 and sys.argv[2] == "install": if len(sys.argv) > 2 and sys.argv[2] == "install":
pip_args = ["--isolated", "--ignore-installed", "--prefix", ctx.python_prefix] pip_args = ["--isolated", "--ignore-installed", "--prefix", ctx.python_prefix]
@ -1504,9 +1505,6 @@ Xcode:
else: else:
args = [pip_path] + pip_args + sys.argv[2:] args = [pip_path] + pip_args + sys.argv[2:]
if not pip_path:
logger.error("pip not found")
sys.exit(1)
import os import os
logger.error("Executing pip with: {}".format(args)) logger.error("Executing pip with: {}".format(args))
os.execve(pip_path, args, pip_env) os.execve(pip_path, args, pip_env)

View file

@ -5,11 +5,7 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
{%- if cookiecutter.python_major == "2" %} #include "Python.h"
#include "{{ cookiecutter.kivy_dir }}/dist/root/python2/include/python2.7/Python.h"
{%- else %}
#include "{{ cookiecutter.kivy_dir }}/dist/root/python3/include/python3.7m/Python.h"
{%- endif %}
#include "{{ cookiecutter.kivy_dir }}/dist/include/common/sdl2/SDL_main.h" #include "{{ cookiecutter.kivy_dir }}/dist/include/common/sdl2/SDL_main.h"
#include <dlfcn.h> #include <dlfcn.h>
@ -31,6 +27,7 @@ int main(int argc, char *argv[]) {
putenv("PYTHONNOUSERSITE=1"); putenv("PYTHONNOUSERSITE=1");
putenv("PYTHONPATH=."); putenv("PYTHONPATH=.");
putenv("PYTHONUNBUFFERED=1"); putenv("PYTHONUNBUFFERED=1");
putenv("LC_CTYPE=UTF-8");
// putenv("PYTHONVERBOSE=1"); // putenv("PYTHONVERBOSE=1");
// putenv("PYOBJUS_DEBUG=1"); // putenv("PYOBJUS_DEBUG=1");
@ -61,7 +58,7 @@ int main(int argc, char *argv[]) {
NSString *python_home = [NSString stringWithFormat:@"PYTHONHOME=%@", resourcePath, nil]; NSString *python_home = [NSString stringWithFormat:@"PYTHONHOME=%@", resourcePath, nil];
putenv((char *)[python_home UTF8String]); putenv((char *)[python_home UTF8String]);
NSString *python_path = [NSString stringWithFormat:@"PYTHONPATH=%@:%@/lib/python3.7/:%@/lib/python3.7/site-packages:.", resourcePath, resourcePath, resourcePath, nil]; NSString *python_path = [NSString stringWithFormat:@"PYTHONPATH=%@:%@/lib/python3.8/:%@/lib/python3.8/site-packages:.", resourcePath, resourcePath, resourcePath, nil];
putenv((char *)[python_path UTF8String]); putenv((char *)[python_path UTF8String]);
NSString *tmp_path = [NSString stringWithFormat:@"TMP=%@/tmp", resourcePath, nil]; NSString *tmp_path = [NSString stringWithFormat:@"TMP=%@/tmp", resourcePath, nil];
@ -163,6 +160,8 @@ void load_custom_builtin_importer() {
" sys.modules['subprocess'].PIPE = None\n" \ " sys.modules['subprocess'].PIPE = None\n" \
" sys.modules['subprocess'].STDOUT = None\n" \ " sys.modules['subprocess'].STDOUT = None\n" \
" sys.modules['subprocess'].DEVNULL = None\n" \ " sys.modules['subprocess'].DEVNULL = None\n" \
" sys.modules['subprocess'].CalledProcessError = Exception\n" \
" sys.modules['subprocess'].check_output = None\n" \
"except ImportError:\n" \ "except ImportError:\n" \
" EXTS = ['.so']\n" " EXTS = ['.so']\n"
"# Fake redirection to supress console output\n" \ "# Fake redirection to supress console output\n" \

View file

@ -291,7 +291,7 @@
GCC_PREPROCESSOR_DEFINITIONS = "DEBUG=1"; GCC_PREPROCESSOR_DEFINITIONS = "DEBUG=1";
GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
HEADER_SEARCH_PATHS = ( HEADER_SEARCH_PATHS = (
"{{ cookiecutter.dist_dir }}/root/python/include", "{{ cookiecutter.dist_dir }}/root/python3/include/python3.8/**",
"{{ cookiecutter.dist_dir }}/include/common/sdl2", "{{ cookiecutter.dist_dir }}/include/common/sdl2",
); );
INFOPLIST_FILE = "{{ cookiecutter.project_name }}-Info.plist"; INFOPLIST_FILE = "{{ cookiecutter.project_name }}-Info.plist";

View file

@ -12,6 +12,7 @@ setenv =
deps = flake8 deps = flake8
commands = flake8 recipes/ tools/ tests/ .ci/ toolchain.py commands = flake8 recipes/ tools/ tests/ .ci/ toolchain.py
[flake8] [flake8]
exclude = tools/external/, exclude = tools/external/,
toolchain.py, # Temporary removal: TODO: ZenCODE toolchain.py, # Temporary removal: TODO: ZenCODE