diff options
author | fuzzard <fuzzard@kodi.tv> | 2022-04-03 21:59:39 +0200 |
---|---|---|
committer | fuzzard <fuzzard@kodi.tv> | 2022-10-31 12:56:50 +1000 |
commit | aac453eb5d7d1a79eaf7f5cc208906d808021ac9 (patch) | |
tree | 7c4fde183d1ac9d3958e61e4292ef8ebe3ab530f /tools/depends/target/python3/darwin_embedded.patch | |
parent | d37c91b7640c61f3334be352f8b7e1ce336b6ad8 (diff) |
[tools/depends] Python 3.11.0
Diffstat (limited to 'tools/depends/target/python3/darwin_embedded.patch')
-rw-r--r-- | tools/depends/target/python3/darwin_embedded.patch | 273 |
1 files changed, 73 insertions, 200 deletions
diff --git a/tools/depends/target/python3/darwin_embedded.patch b/tools/depends/target/python3/darwin_embedded.patch index 92c4f2d043..6eb6ba4d4a 100644 --- a/tools/depends/target/python3/darwin_embedded.patch +++ b/tools/depends/target/python3/darwin_embedded.patch @@ -1,6 +1,17 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -6785,7 +6785,7 @@ + AS_CASE([$ac_sys_system], + [AIX], [PY_STDLIB_MOD_SET_NA([_scproxy], [spwd])], + [VxWorks*], [PY_STDLIB_MOD_SET_NA([_scproxy], [_crypt], [termios], [grp])], +- [Darwin], [PY_STDLIB_MOD_SET_NA([ossaudiodev], [spwd])], ++ [Darwin], [PY_STDLIB_MOD_SET_NA([ossaudiodev], [spwd], [_posixsubprocess], [_scproxy], [_tkinter], [_xxsubinterpreters])], + [CYGWIN*], [PY_STDLIB_MOD_SET_NA([_scproxy], [nis])], + [QNX*], [PY_STDLIB_MOD_SET_NA([_scproxy], [nis])], + [FreeBSD*], [PY_STDLIB_MOD_SET_NA([_scproxy], [spwd])], --- a/Lib/os.py +++ b/Lib/os.py -@@ -605,6 +605,7 @@ +@@ -604,6 +604,7 @@ fullname = path.join(dir, file) try: exec_func(fullname, *argrest) @@ -10,7 +21,7 @@ except OSError as e: --- a/Lib/platform.py +++ b/Lib/platform.py -@@ -615,7 +615,7 @@ +@@ -607,7 +607,7 @@ default in case the command should fail. """ @@ -21,68 +32,18 @@ --- a/Lib/subprocess.py +++ b/Lib/subprocess.py -@@ -762,6 +762,8 @@ - pass_fds=(), *, user=None, group=None, extra_groups=None, - encoding=None, errors=None, text=None, umask=-1): - """Create new Popen instance.""" -+ raise RuntimeError("Subprocesses are not supported on this platform.") -+ - _cleanup() - # Held while anything is calling waitpid before returncode has been - # updated to prevent clobbering returncode if wait() or poll() are -@@ -1046,6 +1048,7 @@ - if not self._child_created: - # We didn't get to successfully create a child process. - return -+ return - if self.returncode is None: - # Not reading subprocess exit status creates a zombie process which - # is only destroyed at the parent python process exit -@@ -1679,6 +1682,7 @@ - else: - args = list(args) - -+ shell = False - if shell: - # On Android the default shell is at '/system/bin/sh'. - unix_shell = ('/system/bin/sh' if -@@ -1762,6 +1766,7 @@ - gid, gids, uid, umask, - preexec_fn) - self._child_created = True -+ return - finally: - # be sure the FD is closed no matter what - os.close(errpipe_write) -@@ -1781,6 +1786,7 @@ - finally: - # be sure the FD is closed no matter what - os.close(errpipe_read) -+ return - - if errpipe_data: - try: -@@ -1834,7 +1840,7 @@ - else: - self.returncode = waitstatus_to_exitcode(sts) +@@ -75,7 +75,7 @@ + _mswindows = True -- def _internal_poll(self, _deadstate=None, _waitpid=os.waitpid, -+ def _internal_poll(self, _deadstate=None, _waitpid=None, - _WNOHANG=os.WNOHANG, _ECHILD=errno.ECHILD): - """Check if child process has terminated. Returns returncode - attribute. -@@ -1843,6 +1849,8 @@ - outside of the local scope (nor can any methods it calls). + # wasm32-emscripten and wasm32-wasi do not support processes +-_can_fork_exec = sys.platform not in {"emscripten", "wasi"} ++_can_fork_exec = sys.platform not in {"emscripten", "wasi", "darwin"} - """ -+ if _waitpid is None: -+ _waitpid = os.waitpid - if self.returncode is None: - if not self._waitpid_lock.acquire(False): - # Something else is busy calling waitpid. Don't allow two + if _mswindows: + import _winapi --- a/Lib/urllib/request.py +++ b/Lib/urllib/request.py -@@ -2617,11 +2617,9 @@ +@@ -2624,11 +2624,9 @@ if sys.platform == 'darwin': @@ -95,7 +56,7 @@ def getproxies_macosx_sysconf(): """Return a dictionary of scheme -> proxy server URL mappings. -@@ -2629,7 +2627,7 @@ +@@ -2636,7 +2636,7 @@ This function uses the MacOSX framework SystemConfiguration to fetch the proxy information. """ @@ -104,7 +65,7 @@ -@@ -2642,9 +2640,9 @@ +@@ -2649,9 +2649,9 @@ """ proxies = getproxies_environment() if proxies: @@ -118,74 +79,33 @@ return getproxies_environment() or getproxies_macosx_sysconf() --- a/Modules/_posixsubprocess.c +++ b/Modules/_posixsubprocess.c -@@ -100,6 +100,9 @@ - return 0; - } +@@ -71,6 +71,10 @@ + #define MAX_GROUPS 64 + #endif +#if defined(__APPLE__) +#include <TargetConditionals.h> +#endif - - /* Convert ASCII to a positive int, no libc call. no overflow. -1 on error. */ - static int -@@ -456,14 +459,14 @@ - goto error; - - /* Close parent's pipe ends. */ -- if (p2cwrite != -1) -+/* if (p2cwrite != -1) - POSIX_CALL(close(p2cwrite)); - if (c2pread != -1) - POSIX_CALL(close(c2pread)); - if (errread != -1) - POSIX_CALL(close(errread)); - POSIX_CALL(close(errpipe_read)); -- -+*/ - /* When duping fds, if there arises a situation where one of the fds is - either 0, 1 or 2, it is possible that it is overwritten (#12607). */ - if (c2pwrite == 0) { -@@ -508,6 +511,8 @@ - /* We no longer manually close p2cread, c2pwrite, and errwrite here as - * _close_open_fds takes care when it is not already non-inheritable. */ - -+ const char *currentDir = getcwd(NULL, 0); + - if (cwd) - POSIX_CALL(chdir(cwd)); + #define POSIX_CALL(call) do { if ((call) == -1) goto error; } while (0) -@@ -552,13 +557,13 @@ - errno = 0; /* We don't want to report an OSError. */ - goto error; - } -- /* Py_DECREF(result); - We're about to exec so why bother? */ -+ Py_DECREF(result); /* - We're about to exec so why bother? */ - } - - /* close FDs after executing preexec_fn, which might open FDs */ - if (close_fds) { - /* TODO HP-UX could use pstat_getproc() if anyone cares about it. */ -- _close_open_fds(3, py_fds_to_keep); -+// _close_open_fds(3, py_fds_to_keep); - } - - /* This loop matches the Lib/os.py _execvpe()'s PATH search when */ -@@ -567,20 +572,34 @@ + static struct PyModuleDef _posixsubprocessmodule; +@@ -661,14 +665,25 @@ for (i = 0; exec_array[i] != NULL; ++i) { const char *executable = exec_array[i]; if (envp) { +- execve(executable, argv, envp); +#if defined(TARGET_OS_TV) + saved_errno = ENOTSUP; +#elif defined(TARGET_OS_IOS) - execve(executable, argv, envp); + saved_errno = execve(executable, argv, envp); +#endif + break; } else { +- execv(executable, argv); +#if defined(TARGET_OS_TV) + saved_errno = ENOTSUP; +#elif defined(TARGET_OS_IOS) - execv(executable, argv); + saved_errno = execv(executable, argv); +#endif + break; @@ -198,101 +118,54 @@ /* Report the first exec error, not the last. */ if (saved_errno) errno = saved_errno; +@@ -751,7 +766,12 @@ + } else + #endif + { ++#if defined(TARGET_OS_TV) ++ pid = -1; ++ errno = ENOTSUP; ++#else + pid = fork(); ++#endif + } + + if (pid != 0) { +@@ -763,6 +783,7 @@ + * the code below. + */ + ++#if !defined(TARGET_OS_TV) + if (preexec_fn != Py_None) { + /* We'll be calling back into Python later so we need to do this. + * This call may not be async-signal-safe but neither is calling +@@ -779,6 +800,7 @@ + call_setuid, uid, child_umask, child_sigmask, + py_fds_to_keep, preexec_fn, preexec_fn_args_tuple); + _exit(255); ++#endif + return 0; /* Dead code to avoid a potential compiler warning. */ + } - error: - saved_errno = errno; -+ chdir(currentDir); - /* Report the posix error to our parent process. */ - /* We ignore all write() return values as the total size of our writes is - less than PIPEBUF and we cannot do anything about an error anyways. -@@ -837,11 +856,12 @@ +@@ -990,8 +1012,10 @@ preexec_fn_args_tuple = PyTuple_New(0); if (!preexec_fn_args_tuple) goto cleanup; -- PyOS_BeforeFork(); -+// PyOS_BeforeFork(); ++#if !defined(TARGET_OS_TV) + PyOS_BeforeFork(); need_after_fork = 1; ++#endif } -- pid = fork(); -+ pid = -1; -+ errno = ENOTSUP; - if (pid == 0) { - /* Child process */ - /* -@@ -855,7 +875,7 @@ - * This call may not be async-signal-safe but neither is calling - * back into Python. The user asked us to use hope as a strategy - * to avoid deadlock... */ -- PyOS_AfterFork_Child(); -+// PyOS_AfterFork_Child(); - } - - child_exec(exec_array, argv, envp, cwd, -@@ -876,8 +896,8 @@ - - Py_XDECREF(cwd_obj2); + /* NOTE: When old_sigmask is non-NULL, do_fork_exec() may use vfork(). */ +@@ -1051,8 +1073,10 @@ + } + #endif -- if (need_after_fork) -- PyOS_AfterFork_Parent(); -+// if (need_after_fork) -+// PyOS_AfterFork_Parent(); - if (envp) - _Py_FreeCharPArray(envp); - if (argv) ---- a/Modules/getpath.c -+++ b/Modules/getpath.c -@@ -935,8 +935,10 @@ - will fail if a relative path was used. but in that case, - absolutize() should help us out below - */ -- if (_NSGetExecutablePath(execpath, &nsexeclength) != 0 -- || (wchar_t)execpath[0] != SEP) -+ char *iospath = Py_GETENV("PYTHONHOME"); -+ char *prog = Py_GETENV("PYTHONEXECUTABLE"); -+ sprintf(execpath, "%s/bin/%s", iospath, prog); -+ if (execpath[0] != SEP) - { - /* _NSGetExecutablePath() failed or the path is relative */ - return _PyStatus_OK(); ---- a/Modules/posixmodule.c -+++ b/Modules/posixmodule.c -@@ -313,8 +313,8 @@ - # else - /* Unix functions that the configure script doesn't check for */ - # ifndef __VXWORKS__ --# define HAVE_EXECV 1 --# define HAVE_FORK 1 -+//# define HAVE_EXECV 0 -+//# define HAVE_FORK 0 - # if defined(__USLC__) && defined(__SCO_VERSION__) /* SCO UDK Compiler */ - # define HAVE_FORK1 1 - # endif -@@ -327,8 +327,8 @@ - # define HAVE_KILL 1 - # define HAVE_OPENDIR 1 - # define HAVE_PIPE 1 --# define HAVE_SYSTEM 1 --# define HAVE_WAIT 1 -+//# define HAVE_SYSTEM 0 -+//# define HAVE_WAIT 0 - # define HAVE_TTYNAME 1 - # endif /* _MSC_VER */ - #endif /* ! __WATCOMC__ || __QNX__ */ ---- a/Include/intrcheck.h -+++ b/Include/intrcheck.h -@@ -7,13 +7,13 @@ ++#if !defined(TARGET_OS_TV) + if (need_after_fork) + PyOS_AfterFork_Parent(); ++#endif - PyAPI_FUNC(int) PyOS_InterruptOccurred(void); - PyAPI_FUNC(void) PyOS_InitInterrupts(void); --#ifdef HAVE_FORK -+//#ifdef HAVE_FORK - #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03070000 - PyAPI_FUNC(void) PyOS_BeforeFork(void); - PyAPI_FUNC(void) PyOS_AfterFork_Parent(void); - PyAPI_FUNC(void) PyOS_AfterFork_Child(void); - #endif --#endif -+//#endif - /* Deprecated, please use PyOS_AfterFork_Child() instead */ - Py_DEPRECATED(3.7) PyAPI_FUNC(void) PyOS_AfterFork(void); + cleanup: + if (saved_errno != 0) { |