diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 654077a..4b657e4 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -11,14 +11,17 @@ on: required: false type: boolean +env: + MACOSX_DEPLOYMENT_TARGET: 10.5 + jobs: tests: runs-on: ${{ matrix.runs-on }} strategy: - fail-fast: false + fail-fast: true matrix: runs-on: [macos-latest] - python-version: [3.8.18, 3.9.18, 3.10.13] + python-version: [3.8.18, 3.9.18, 3.10.13, 3.11.7] name: python-${{ matrix.python-version }}-${{ matrix.runs-on }} steps: @@ -40,17 +43,19 @@ jobs: cmake \ ${{ inputs.verbose && '--trace-expand --debug-find' || '' }} \ -DCMAKE_INSTALL_PREFIX:PATH=${{ github.workspace }}/python-install \ - -DCMAKE_OSX_DEPLOYMENT_TARGET=10.13 \ - -DCMAKE_C_STANDARD=99 \ + -DCMAKE_OSX_DEPLOYMENT_TARGET=${{ env.MACOSX_DEPLOYMENT_TARGET }} \ + ${{ startsWith(matrix.python-version, '3.11') && '-DUSE_SYSTEM_TCL=OFF' || '' }} \ -DPYTHON_VERSION=${{ matrix.python-version }} \ .. - make -j4 + make -j4 ${{ inputs.verbose && 'VERBOSE=1' || '' }} make install - + - name: Check sysconfig run: | ./python-install/bin/python -m sysconfig - name: Test run: | - ./python-install/bin/python -m test || true + ./python-install/bin/python -m ensurepip || true + ./python-install/bin/python -m pip install certifi || true + ./python-install/bin/python -m test -v --timeout 60 || true diff --git a/CMakeLists.txt b/CMakeLists.txt index f50f4f2..d407f34 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -288,6 +288,8 @@ set(_download_3.10.10_md5 "6dbe644dd1a520d9853cf6648084c346") set(_download_3.10.11_md5 "7e25e2f158b1259e271a45a249cb24bb") set(_download_3.10.12_md5 "1d64320e0b0df6e9ab7e611bacb2178d") set(_download_3.10.13_md5 "cbcad7f5e759176bf8ce8a5f9d487087") +# 3.11.x +set(_download_3.11.7_md5 "ef61f81ec82c490484219c7f0ec96783") set(_extracted_dir "Python-${PY_VERSION}") @@ -379,6 +381,13 @@ if(WIN32 AND IS_PY3) enable_language(CXX) endif() +if(PY_VERSION VERSION_GREATER_EQUAL "3.11") + set(CMAKE_C_STANDARD "11") + find_package(Python3 COMPONENTS Interpreter) +else() + set(CMAKE_C_STANDARD "99") +endif() + # Options depending of the python version if(IS_PY2) cmake_dependent_option(USE_SYSTEM_DB "Use system DB" ON "USE_SYSTEM_LIBRARIES" OFF) diff --git a/cmake/ConfigureChecks.cmake b/cmake/ConfigureChecks.cmake index a75d470..5c3c18d 100644 --- a/cmake/ConfigureChecks.cmake +++ b/cmake/ConfigureChecks.cmake @@ -96,7 +96,9 @@ if(USE_SYSTEM_GDBM) if(NDBM_INCLUDE_PATH) set(NDBM_TAG NDBM) + set(NDBM_USE NDBM) else() + set(NDBM_USE GDBM_COMPAT) find_path(GDBM_NDBM_INCLUDE_PATH gdbm/ndbm.h) if(GDBM_NDBM_INCLUDE_PATH) set(NDBM_TAG GDBM_NDBM) @@ -112,6 +114,7 @@ message(STATUS "GDBM_INCLUDE_PATH=${GDBM_INCLUDE_PATH}") message(STATUS "GDBM_LIBRARY=${GDBM_LIBRARY}") message(STATUS "GDBM_COMPAT_LIBRARY=${GDBM_COMPAT_LIBRARY}") message(STATUS "NDBM_TAG=${NDBM_TAG}") +message(STATUS "NDBM_USE=${NDBM_USE}") message(STATUS "_INCLUDE_PATH=${${NDBM_TAG}_INCLUDE_PATH}") find_path(LZMA_INCLUDE_PATH lzma.h) @@ -812,12 +815,15 @@ set(CFG_HEADERS ${CFG_HEADERS} time.h stdio.h math.h) check_symbol_exists(alarm "${CFG_HEADERS}" HAVE_ALARM) check_symbol_exists(alloca "${CFG_HEADERS}" HAVE_ALLOCA) # libffi and cpython check_symbol_exists(altzone "${CFG_HEADERS}" HAVE_ALTZONE) +check_symbol_exists(bind "${CFG_HEADERS}" HAVE_BIND) check_symbol_exists(bind_textdomain_codeset "${CFG_HEADERS}" HAVE_BIND_TEXTDOMAIN_CODESET) check_symbol_exists(chflags "${CFG_HEADERS}" HAVE_CHFLAGS) +check_symbol_exists(chmod "${CFG_HEADERS}" HAVE_CHMOD) check_symbol_exists(chown "${CFG_HEADERS}" HAVE_CHOWN) check_symbol_exists(chroot "${CFG_HEADERS}" HAVE_CHROOT) check_symbol_exists(clock "${CFG_HEADERS}" HAVE_CLOCK) check_symbol_exists(confstr "${CFG_HEADERS}" HAVE_CONFSTR) +check_symbol_exists(connect "${CFG_HEADERS}" HAVE_CONNECT) check_symbol_exists(ctermid "${CFG_HEADERS}" HAVE_CTERMID) check_symbol_exists(ctermid_r "${CFG_HEADERS}" HAVE_CTERMID_R) check_symbol_exists(dup2 "${CFG_HEADERS}" HAVE_DUP2) @@ -858,6 +864,7 @@ if(IS_PY2) check_symbol_exists(getcwd "${CFG_HEADERS}" HAVE_GETCWD) endif() check_symbol_exists(getc_unlocked "${CFG_HEADERS}" HAVE_GETC_UNLOCKED) +check_symbol_exists(getgid "${CFG_HEADERS}" HAVE_GETGID) check_symbol_exists(getgroups "${CFG_HEADERS}" HAVE_GETGROUPS) check_symbol_exists(getitimer "${CFG_HEADERS}" HAVE_GETITIMER) check_symbol_exists(getloadavg "${CFG_HEADERS}" HAVE_GETLOADAVG) @@ -866,14 +873,17 @@ check_symbol_exists(getpagesize "${CFG_HEADERS}" HAVE_GETPAGESIZE) check_symbol_exists(getpgid "${CFG_HEADERS}" HAVE_GETPGID) check_symbol_exists(getpgrp "${CFG_HEADERS}" HAVE_GETPGRP) check_symbol_exists(getpid "${CFG_HEADERS}" HAVE_GETPID) +check_symbol_exists(getppid "${CFG_HEADERS}" HAVE_GETPPID) python_check_function(getpriority HAVE_GETPRIORITY) check_symbol_exists(getpwent "${CFG_HEADERS}" HAVE_GETPWENT) check_symbol_exists(getresgid "${CFG_HEADERS}" HAVE_GETRESGID) check_symbol_exists(getresuid "${CFG_HEADERS}" HAVE_GETRESUID) check_symbol_exists(getsid "${CFG_HEADERS}" HAVE_GETSID) +check_symbol_exists(getsockname "${CFG_HEADERS}" HAVE_GETSOCKNAME) check_symbol_exists(getspent "${CFG_HEADERS}" HAVE_GETSPENT) check_symbol_exists(getspnam "${CFG_HEADERS}" HAVE_GETSPNAM) check_symbol_exists(gettimeofday "${CFG_HEADERS}" HAVE_GETTIMEOFDAY) +check_symbol_exists(getuid "${CFG_HEADERS}" HAVE_GETUID) check_symbol_exists(getwd "${CFG_HEADERS}" HAVE_GETWD) check_symbol_exists(hypot "${CFG_HEADERS}" HAVE_HYPOT) check_symbol_exists(initgroups "${CFG_HEADERS}" HAVE_INITGROUPS) @@ -884,6 +894,7 @@ check_symbol_exists(lchflags "${CFG_HEADERS}" HAVE_LCHFLAGS) python_check_function(lchmod HAVE_LCHMOD) check_symbol_exists(lchown "${CFG_HEADERS}" HAVE_LCHOWN) check_symbol_exists(link "${CFG_HEADERS}" HAVE_LINK) +check_symbol_exists(listen "${CFG_HEADERS}" HAVE_LISTEN) check_symbol_exists(lstat "${CFG_HEADERS}" HAVE_LSTAT) check_symbol_exists(makedev "${CFG_HEADERS}" HAVE_MAKEDEV) check_symbol_exists(memcpy "${CFG_HEADERS}" HAVE_MEMCPY) # libffi and cpython @@ -894,6 +905,7 @@ check_symbol_exists(mktime "${CFG_HEADERS}" HAVE_MKTIME) check_symbol_exists(mmap "${CFG_HEADERS}" HAVE_MMAP) # libffi and cpython check_symbol_exists(mremap "${CFG_HEADERS}" HAVE_MREMAP) check_symbol_exists(nice "${CFG_HEADERS}" HAVE_NICE) +check_symbol_exists(opendir "${CFG_HEADERS}" HAVE_OPENDIR) check_symbol_exists(openpty "${CFG_HEADERS}" HAVE_OPENPTY) check_symbol_exists(pathconf "${CFG_HEADERS}" HAVE_PATHCONF) check_symbol_exists(pause "${CFG_HEADERS}" HAVE_PAUSE) @@ -902,7 +914,9 @@ check_symbol_exists(poll "${CFG_HEADERS}" HAVE_POLL) check_symbol_exists(putenv "${CFG_HEADERS}" HAVE_PUTENV) check_symbol_exists(readlink "${CFG_HEADERS}" HAVE_READLINK) check_symbol_exists(realpath "${CFG_HEADERS}" HAVE_REALPATH) +check_symbol_exists(recvfrom "${CFG_HEADERS}" HAVE_RECVFROM) check_symbol_exists(select "${CFG_HEADERS}" HAVE_SELECT) +check_symbol_exists(sendto "${CFG_HEADERS}" HAVE_SENDTO) check_symbol_exists(setegid "${CFG_HEADERS}" HAVE_SETEGID) check_symbol_exists(seteuid "${CFG_HEADERS}" HAVE_SETEUID) check_symbol_exists(setgid "${CFG_HEADERS}" HAVE_SETGID) @@ -916,18 +930,22 @@ check_symbol_exists(setreuid "${CFG_HEADERS}" HAVE_SETREUID) check_symbol_exists(setresgid "${CFG_HEADERS}" HAVE_SETRESGID) check_symbol_exists(setresuid "${CFG_HEADERS}" HAVE_SETRESUID) check_symbol_exists(setsid "${CFG_HEADERS}" HAVE_SETSID) +check_symbol_exists(setsockopt "${CFG_HEADERS}" HAVE_SETSOCKOPT) check_symbol_exists(setuid "${CFG_HEADERS}" HAVE_SETUID) check_symbol_exists(setvbuf "${CFG_HEADERS}" HAVE_SETVBUF) +check_symbol_exists(shutdown "${CFG_HEADERS}" HAVE_SHUTDOWN) check_symbol_exists(sigaction "${CFG_HEADERS}" HAVE_SIGACTION) check_symbol_exists(siginterrupt "${CFG_HEADERS}" HAVE_SIGINTERRUPT) check_symbol_exists(sigrelse "${CFG_HEADERS}" HAVE_SIGRELSE) check_symbol_exists(snprintf "${CFG_HEADERS}" HAVE_SNPRINTF) +check_symbol_exists(socket "${CFG_HEADERS}" HAVE_SOCKET) check_symbol_exists(socketpair "${CFG_HEADERS}" HAVE_SOCKETPAIR) check_symbol_exists(statvfs "${CFG_HEADERS}" HAVE_STATVFS) check_symbol_exists(strdup "${CFG_HEADERS}" HAVE_STRDUP) check_symbol_exists(strftime "${CFG_HEADERS}" HAVE_STRFTIME) check_symbol_exists(symlink "${CFG_HEADERS}" HAVE_SYMLINK) check_symbol_exists(sysconf "${CFG_HEADERS}" HAVE_SYSCONF) +check_symbol_exists(system "${CFG_HEADERS}" HAVE_SYSTEM) check_symbol_exists(tcgetpgrp "${CFG_HEADERS}" HAVE_TCGETPGRP) check_symbol_exists(tcsetpgrp "${CFG_HEADERS}" HAVE_TCSETPGRP) check_symbol_exists(tempnam "${CFG_HEADERS}" HAVE_TEMPNAM) @@ -937,9 +955,12 @@ check_symbol_exists(tmpfile "${CFG_HEADERS}" HAVE_TMPFILE) check_symbol_exists(tmpnam "${CFG_HEADERS}" HAVE_TMPNAM) check_symbol_exists(tmpnam_r "${CFG_HEADERS}" HAVE_TMPNAM_R) check_symbol_exists(truncate "${CFG_HEADERS}" HAVE_TRUNCATE) +check_symbol_exists(ttyname "${CFG_HEADERS}" HAVE_TTYNAME) +check_symbol_exists(umask "${CFG_HEADERS}" HAVE_UMASK) check_symbol_exists(uname "${CFG_HEADERS}" HAVE_UNAME) check_symbol_exists(unsetenv "${CFG_HEADERS}" HAVE_UNSETENV) check_symbol_exists(utimes "${CFG_HEADERS}" HAVE_UTIMES) +check_symbol_exists(wait "${CFG_HEADERS}" HAVE_WAIT) check_symbol_exists(wait3 "${CFG_HEADERS}" HAVE_WAIT3) check_symbol_exists(wait4 "${CFG_HEADERS}" HAVE_WAIT4) check_symbol_exists(waitpid "${CFG_HEADERS}" HAVE_WAITPID) @@ -947,6 +968,7 @@ check_symbol_exists(wcscoll "${CFG_HEADERS}" HAVE_WCSCOLL) check_symbol_exists(_getpty "${CFG_HEADERS}" HAVE__GETPTY) if(IS_PY3) +check_symbol_exists(accept "${CFG_HEADERS}" HAVE_ACCEPT) check_symbol_exists(accept4 "${CFG_HEADERS}" HAVE_ACCEPT4) check_symbol_exists(copy_file_range "${CFG_HEADERS}" HAVE_COPY_FILE_RANGE) check_symbol_exists(dup3 "${CFG_HEADERS}" HAVE_DUP3) @@ -983,6 +1005,7 @@ check_symbol_exists(mkdirat "${CFG_HEADERS}" HAVE_MKDIRAT) check_symbol_exists(mkfifoat "${CFG_HEADERS}" HAVE_MKFIFOAT) check_symbol_exists(mknodat "${CFG_HEADERS}" HAVE_MKNODAT) check_symbol_exists(openat "${CFG_HEADERS}" HAVE_OPENAT) +check_symbol_exists(pipe "${CFG_HEADERS}" HAVE_PIPE) check_symbol_exists(pipe2 "${CFG_HEADERS}" HAVE_PIPE2) check_symbol_exists(posix_fadvise "${CFG_HEADERS}" HAVE_POSIX_FADVISE) check_symbol_exists(posix_fallocate "${CFG_HEADERS}" HAVE_POSIX_FALLOCATE) @@ -1882,6 +1905,7 @@ endif() check_symbol_exists(gai_strerror "${CFG_HEADERS}" HAVE_GAI_STRERROR) check_symbol_exists(getaddrinfo "${CFG_HEADERS}" HAVE_GETADDRINFO) check_symbol_exists(getnameinfo "${CFG_HEADERS}" HAVE_GETNAMEINFO) +check_symbol_exists(gethostbyaddr "${CFG_HEADERS}" HAVE_GETHOSTBYADDR) check_symbol_exists(getpeername "${CFG_HEADERS}" HAVE_GETPEERNAME) check_symbol_exists(hstrerror "${CFG_HEADERS}" HAVE_HSTRERROR) check_symbol_exists(inet_aton "${CFG_HEADERS}" HAVE_INET_ATON) diff --git a/cmake/config-mingw/pyconfig.h b/cmake/config-mingw/pyconfig.h index 92117f7..b48bd3c 100644 --- a/cmake/config-mingw/pyconfig.h +++ b/cmake/config-mingw/pyconfig.h @@ -121,9 +121,11 @@ WIN32 is still required for the locale module. #define HAVE_SSIZE_T 1 #include -#define Py_IS_NAN _isnan -#define Py_IS_INFINITY(X) (!_finite(X) && !_isnan(X)) -#define Py_IS_FINITE(X) _finite(X) +#if PY_VERSION_HEX < 0x030B0000 +# define Py_IS_NAN _isnan +# define Py_IS_INFINITY(X) (!_finite(X) && !_isnan(X)) +# define Py_IS_FINITE(X) _finite(X) +#endif #define copysign _copysign #include diff --git a/cmake/config-unix/pyconfig.h.in b/cmake/config-unix/pyconfig.h.in index e8c8c2a..d12605f 100644 --- a/cmake/config-unix/pyconfig.h.in +++ b/cmake/config-unix/pyconfig.h.in @@ -62,6 +62,9 @@ the case on Motorola V4 (R40V4.2) */ #cmakedefine GETTIMEOFDAY_NO_TZ 1 +/* Define to 1 if you have the `accept' function. [Python 3.11] */ +#cmakedefine HAVE_ACCEPT 1 + /* Define to 1 if you have the `accept4' function. [Python 3] */ #cmakedefine HAVE_ACCEPT4 1 @@ -95,6 +98,9 @@ /* Define if GCC supports __attribute__((format(PyArg_ParseTuple, 2, 3))) [Python 2.7] */ #cmakedefine HAVE_ATTRIBUTE_FORMAT_PARSETUPLE 1 +/* Define to 1 if you have the `bind' function. [Python 3.11] */ +#cmakedefine HAVE_BIND 1 + /* Define to 1 if you have the `bind_textdomain_codeset' function. */ #cmakedefine HAVE_BIND_TEXTDOMAIN_CODESET 1 @@ -138,6 +144,9 @@ /* Define to 1 if you have the 'chflags' function. */ #cmakedefine HAVE_CHFLAGS 1 +/* Define to 1 if you have the `chmod' function. [Python 3.11] */ +#cmakedefine HAVE_CHMOD 1 + /* Define to 1 if you have the `chown' function. */ #cmakedefine HAVE_CHOWN 1 @@ -165,6 +174,9 @@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_CONIO_H 1 +/* Define to 1 if you have the `connect' function. [Python 3.11] */ +#cmakedefine HAVE_CONNECT 1 + /* Define to 1 if you have the `copysign' function. */ #cmakedefine HAVE_COPYSIGN 1 @@ -449,9 +461,18 @@ /* Define this if you have flockfile(), getc_unlocked(), and funlockfile() */ #cmakedefine HAVE_GETC_UNLOCKED 1 +/* Define to 1 if you have the `getegid' function. [Python 3.11] */ +#cmakedefine HAVE_GETEGID 1 + +/* Define to 1 if you have the `geteuid' function. [Python 3.11] */ +#cmakedefine HAVE_GETEUID 1 + /* Define to 1 if you have the `getentropy' function. [Python 3] */ #cmakedefine HAVE_GETENTROPY 1 +/* Define to 1 if you have the `getgid' function. [Python 3.1] */ +#cmakedefine HAVE_GETGID 1 + /* Define to 1 if you have the `getgrgid_r' function. [Python 3.8] */ #cmakedefine HAVE_GETGRGID_R 1 @@ -464,6 +485,9 @@ /* Define to 1 if you have the `getgroups' function. */ #cmakedefine HAVE_GETGROUPS 1 +/* Define to 1 if you have the `gethostbyaddr' function. [Python 3.11] */ +#cmakedefine HAVE_GETHOSTBYADDR 1 + /* Define to 1 if you have the `gethostbyname' function. */ #cmakedefine HAVE_GETHOSTBYNAME 1 @@ -491,6 +515,9 @@ /* Define to 1 if you have the `getnameinfo' function. */ #cmakedefine HAVE_GETNAMEINFO 1 +/* Define if you have the 'getppid' function. [Python 3.11] */ +#cmakedefine HAVE_GETPPID 1 + /* Define if you have the 'getpagesize' function. */ #cmakedefine HAVE_GETPAGESIZE 1 @@ -533,6 +560,9 @@ /* Define to 1 if you have the `getsid' function. */ #cmakedefine HAVE_GETSID 1 +/* Define to 1 if you have the `getsockname' function. [Python 3.11] */ +#cmakedefine HAVE_GETSOCKNAME 1 + /* Define to 1 if you have the `getspent' function. */ #cmakedefine HAVE_GETSPENT 1 @@ -542,6 +572,9 @@ /* Define to 1 if you have the `gettimeofday' function. */ #cmakedefine HAVE_GETTIMEOFDAY 1 +/* Define to 1 if you have the `getuid' function. [Python 3.11] */ +#cmakedefine HAVE_GETUID 1 + /* Define to 1 if you have the `getwd' function. */ #cmakedefine HAVE_GETWD 1 @@ -693,6 +726,9 @@ /* Define to 1 if you have the header file. [Python 3.9] */ #cmakedefine HAVE_LINUX_WAIT_H 1 +/* Define to 1 if you have the `listen' function. [Python 3.11] */ +#cmakedefine HAVE_LISTEN 1 + /* Define to 1 if you have the `lockf' function. [Python 3] */ #cmakedefine HAVE_LOCKF 1 @@ -762,6 +798,9 @@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_NCURSES_H 1 +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_NETDB_H 1 + /* Define to 1 if you have the header file, and it defines `DIR'. */ #cmakedefine HAVE_NDIR_H 1 @@ -781,6 +820,9 @@ /* Define to 1 if you have the `openat' function. [Python 3] */ #cmakedefine HAVE_OPENAT 1 +/* Define to 1 if you have the `opendir' function. [Python 3.11] */ +#cmakedefine HAVE_OPENDIR 1 + /* Define to 1 if you have the `openpty' function. */ #cmakedefine HAVE_OPENPTY 1 @@ -793,6 +835,9 @@ /* Define to 1 if you have the `pause' function. */ #cmakedefine HAVE_PAUSE 1 +/* Define to 1 if you have the `pipe' function. [Python 3.11] */ +#cmakedefine HAVE_PIPE 1 + /* Define to 1 if you have the `pipe2' function. [Python 3] */ #cmakedefine HAVE_PIPE2 1 @@ -895,6 +940,9 @@ /* Define to 1 if you have the `realpath' function. */ #cmakedefine HAVE_REALPATH 1 +/* Define to 1 if you have the `recvfrom' function. [Python 3.11] */ +#cmakedefine HAVE_RECVFROM 1 + /* Define to 1 if you have the `renameat' function. [Python 3] */ #cmakedefine HAVE_RENAMEAT 1 @@ -970,6 +1018,9 @@ /* Define to 1 if you have the `sendfile' function. [Python 3] */ #cmakedefine HAVE_SENDFILE 1 +/* Define to 1 if you have the `sendto' function. [Python 3.11] */ +#cmakedefine HAVE_SENDTO 1 + /* Define to 1 if you have the `setegid' function. */ #cmakedefine HAVE_SETEGID 1 @@ -1015,6 +1066,9 @@ /* Define to 1 if you have the `setsid' function. */ #cmakedefine HAVE_SETSID 1 +/* Define to 1 if you have the `setsockopt' function. */ +#cmakedefine HAVE_SETSOCKOPT 1 + /* Define to 1 if you have the `setuid' function. */ #cmakedefine HAVE_SETUID 1 @@ -1030,6 +1084,9 @@ /* Define to 1 if you have the `shm_unlink' function. [Python 3.8] */ #cmakedefine HAVE_SHM_UNLINK 1 +/* Define to 1 if you have the `shutdown' function. [Python 3.11] */ +#cmakedefine HAVE_SHUTDOWN 1 + /* Define to 1 if you have the `sigaction' function. */ #cmakedefine HAVE_SIGACTION 1 @@ -1078,6 +1135,9 @@ /* struct sockaddr_storage (sys/socket.h) */ #cmakedefine HAVE_SOCKADDR_STORAGE 1 +/* Define if you have the 'socket' function. [Python 3.11] */ +#cmakedefine HAVE_SOCKET 1 + /* Define if you have the 'socketpair' function. */ #cmakedefine HAVE_SOCKETPAIR 1 @@ -1173,6 +1233,9 @@ /* Define to 1 if you have the `sysconf' function. */ #cmakedefine HAVE_SYSCONF 1 +/* Define to 1 if you have the `system' function. [Python 3.11] */ +#cmakedefine HAVE_SYSTEM 1 + /* Define to 1 if you have the header file. */ #cmakedefine HAVE_SYSEXITS_H 1 @@ -1335,6 +1398,9 @@ /* Define to 1 if you have the `truncate' function. */ #cmakedefine HAVE_TRUNCATE 1 +/* Define to 1 if you have the `ttyname' function. */ +#cmakedefine HAVE_TTYNAME 1 + /* Define to 1 if you don't have `tm_zone' but do have the external array `tzname'. */ #cmakedefine HAVE_TZNAME 1 @@ -1351,6 +1417,9 @@ /* Define to 1 if the system has the type `uintptr_t'. */ #cmakedefine HAVE_UINTPTR_T 1 +/* Define to 1 if you have the `umask' function. [Python 3.11] */ +#cmakedefine HAVE_UMASK 1 + /* Define to 1 if you have the `uname' function. */ #cmakedefine HAVE_UNAME 1 @@ -1395,6 +1464,9 @@ /* Define to 1 if you have the header file. [Python 3.7] */ #cmakedefine HAVE_UUID_UUID_H 1 +/* Define to 1 if you have the `wait' function. [Python 3.11] */ +#cmakedefine HAVE_WAIT 1 + /* Define to 1 if you have the `wait3' function. */ #cmakedefine HAVE_WAIT3 1 @@ -1557,6 +1629,9 @@ #cmakedefine SIZEOF_LONG @SIZEOF_LONG@ #cmakedefine ALIGNOF_LONG @SIZEOF_LONG@ +/* The size of `long', as computed by alignof. */ +#cmakedefine ALIGNOF_LONG @SIZEOF_LONG@ + /* The size of `long double', as computed by sizeof. */ #cmakedefine SIZEOF_LONG_DOUBLE @SIZEOF_LONG_DOUBLE@ @@ -1582,6 +1657,9 @@ #cmakedefine SIZEOF_SIZE_T @SIZEOF_SIZE_T@ #cmakedefine ALIGNOF_SIZE_T @SIZEOF_SIZE_T@ +/* The size of `size_t', as computed by alignof. */ +#cmakedefine ALIGNOF_SIZE_T @SIZEOF_SIZE_T@ + /* The size of `time_t', as computed by sizeof. */ #cmakedefine SIZEOF_TIME_T @SIZEOF_TIME_T@ diff --git a/cmake/extensions/CMakeLists.txt b/cmake/extensions/CMakeLists.txt index 8f6e608..d4f7243 100644 --- a/cmake/extensions/CMakeLists.txt +++ b/cmake/extensions/CMakeLists.txt @@ -13,7 +13,7 @@ endif() add_python_extension(array ${WIN32_BUILTIN} SOURCES arraymodule.c) add_python_extension(audioop ${WIN32_BUILTIN} REQUIRES HAVE_LIBM SOURCES audioop.c LIBRARIES ${M_LIBRARIES}) add_python_extension(_bisect ${WIN32_BUILTIN} SOURCES _bisectmodule.c) -add_python_extension(cmath REQUIRES HAVE_LIBM ${WIN32_BUILTIN} SOURCES _math.c cmathmodule.c LIBRARIES ${M_LIBRARIES}) +add_python_extension(cmath REQUIRES HAVE_LIBM ${WIN32_BUILTIN} SOURCES $<$:_math.c> cmathmodule.c LIBRARIES ${M_LIBRARIES}) add_python_extension(_codecs_cn ${WIN32_BUILTIN} SOURCES cjkcodecs/_codecs_cn.c) add_python_extension(_codecs_hk ${WIN32_BUILTIN} SOURCES cjkcodecs/_codecs_hk.c) add_python_extension(_codecs_iso2022 ${WIN32_BUILTIN} SOURCES cjkcodecs/_codecs_iso2022.c) @@ -68,7 +68,7 @@ add_python_extension(itertools ${WIN32_BUILTIN} ${PY3_BUILTIN} SOURCES itertools add_python_extension(_json ${WIN32_BUILTIN} SOURCES _json.c) add_python_extension(_locale ${WIN32_BUILTIN} ${PY3_BUILTIN} SOURCES _localemodule.c) # access to ISO C locale support add_python_extension(_lsprof ${WIN32_BUILTIN} SOURCES _lsprof.c rotatingtree.c) -add_python_extension(math ${WIN32_BUILTIN} REQUIRES HAVE_LIBM SOURCES _math.c mathmodule.c LIBRARIES ${M_LIBRARIES}) +add_python_extension(math ${WIN32_BUILTIN} REQUIRES HAVE_LIBM SOURCES $<$:_math.c> mathmodule.c LIBRARIES ${M_LIBRARIES}) add_python_extension(mmap ${WIN32_BUILTIN} SOURCES mmapmodule.c) add_python_extension(_multibytecodec ${WIN32_BUILTIN} SOURCES cjkcodecs/multibytecodec.c) add_python_extension(operator ${WIN32_BUILTIN} REQUIRES IS_PY2 SOURCES operator.c) @@ -102,7 +102,11 @@ add_python_extension(faulthandler ALWAYS_BUILTIN REQUIRES IS_PY3 SOURCES faultha add_python_extension(_opcode ${WIN32_BUILTIN} REQUIRES IS_PY3 SOURCES _opcode.c) add_python_extension(_operator BUILTIN REQUIRES IS_PY3 SOURCES _operator.c) add_python_extension(_pickle ${WIN32_BUILTIN} REQUIRES IS_PY3 SOURCES _pickle.c) -add_python_extension(_sre BUILTIN SOURCES _sre.c) # Fredrik Lundh's new regular expressions +if(PY_VERSION VERSION_LESS "3.11") + add_python_extension(_sre BUILTIN SOURCES _sre.c) # Fredrik Lundh's new regular expressions +else() + add_python_extension(_sre BUILTIN SOURCES _sre/sre.c) # Fredrik Lundh's new regular expressions +endif() add_python_extension(_stat BUILTIN REQUIRES IS_PY3 SOURCES _stat.c) # stat.h interface add_python_extension(_symtable BUILTIN SOURCES symtablemodule.c) # Python PEP-3118 (buffer protocol) test module @@ -709,7 +713,7 @@ endif() add_python_extension(${dbm_name} REQUIRES NDBM_TAG GDBM_LIBRARY GDBM_COMPAT_LIBRARY SOURCES ${dbm${PY_VERSION_MAJOR}_SOURCES} - DEFINITIONS HAVE_${NDBM_TAG}_H + DEFINITIONS HAVE_${NDBM_TAG}_H USE_${NDBM_USE} LIBRARIES ${GDBM_LIBRARY} ${GDBM_COMPAT_LIBRARY} INCLUDEDIRS ${${NDBM_TAG}_INCLUDE_PATH} ) @@ -754,17 +758,24 @@ add_python_extension(readline LIBRARIES ${READLINE_LIBRARY} ${CURSES_LIBRARIES} INCLUDEDIRS ${READLINE_INCLUDE_PATH} ) +set(sqlite3_sources + _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 +) +if(PY_VERSION VERSION_GREATER_EQUAL "3.11") + list(APPEND sqlite3_sources _sqlite/blob.c) +else() + list(APPEND sqlite3_sources _sqlite/cache.c) +endif() add_python_extension(_sqlite3 REQUIRES SQLite3_INCLUDE_DIRS SQLite3_LIBRARIES - SOURCES _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 + SOURCES ${sqlite3_sources} DEFINITIONS MODULE_NAME="sqlite3" SQLITE_OMIT_LOAD_EXTENSION=1 INCLUDEDIRS ${SQLite3_INCLUDE_DIRS} LIBRARIES ${SQLite3_LIBRARIES} @@ -790,9 +801,9 @@ set(_tkinter_REQUIRES TCL_LIBRARY TK_LIBRARY TCL_INCLUDE_PATH TK_INCLUDE_PATH) set(_tkinter_LIBRARIES ${TCL_LIBRARY} ${TK_LIBRARY}) set(_tkinter_INCLUDEDIRS ${TCL_INCLUDE_PATH} ${TK_INCLUDE_PATH}) if(UNIX) - list(APPEND _tkinter_REQUIRES X11_INCLUDE_DIR X11_LIBRARIES) - list(APPEND _tkinter_LIBRARIES ${X11_LIBRARIES}) - list(APPEND _tkinter_INCLUDEDIRS ${X11_INCLUDE_DIR}) + list(APPEND _tkinter_REQUIRES X11_INCLUDE_DIR X11_LIBRARIES) + list(APPEND _tkinter_LIBRARIES ${X11_LIBRARIES}) + list(APPEND _tkinter_INCLUDEDIRS ${X11_INCLUDE_DIR}) endif() add_python_extension(_tkinter REQUIRES ${_tkinter_REQUIRES} diff --git a/cmake/fficonfig.h.in b/cmake/fficonfig.h.in index 753aa41..91e934a 100644 --- a/cmake/fficonfig.h.in +++ b/cmake/fficonfig.h.in @@ -156,6 +156,9 @@ #define SIZEOF_SIZE_T @SIZEOF_SIZE_T@ #define ALIGNOF_SIZE_T @SIZEOF_SIZE_T@ +/* The size of `size_t', as computed by alignof. */ +#define ALIGNOF_SIZE_T @SIZEOF_SIZE_T@ + /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at runtime. diff --git a/cmake/libpython/CMakeLists.txt b/cmake/libpython/CMakeLists.txt index c975c29..b1a52d6 100644 --- a/cmake/libpython/CMakeLists.txt +++ b/cmake/libpython/CMakeLists.txt @@ -3,70 +3,78 @@ add_definitions(-DPy_BUILD_CORE_BUILTIN) add_definitions(-DNDEBUG) set(MODULE_SOURCES # Equivalent to MODULE_OBJS in Makefile.pre - ${PROJECT_BINARY_DIR}/CMakeFiles/config.c ${SRC_DIR}/Modules/gcmodule.c ${SRC_DIR}/Modules/main.c ) -if(UNIX) +if(UNIX OR (PY_VERSION VERSION_LESS "3.11")) list(APPEND MODULE_SOURCES - ${SRC_DIR}/Modules/getpath.c + ${PROJECT_BINARY_DIR}/CMakeFiles/config.c ) - set(PYTHONPATH "${EXTRA_PYTHONPATH}:lib-dynload:plat-${PY_PLATFORM}") - if(ENABLE_TKINTER) - set(PYTHONPATH "${PYTHONPATH}:lib-tk") +endif() +if(UNIX) + if(PY_VERSION VERSION_LESS "3.11") + list(APPEND MODULE_SOURCES + ${SRC_DIR}/Modules/getpath.c + ) + set(PYTHONPATH "${EXTRA_PYTHONPATH}:lib-dynload:plat-${PY_PLATFORM}") + if(ENABLE_TKINTER) + set(PYTHONPATH "${PYTHONPATH}:lib-tk") + endif() + set_property( + SOURCE ${SRC_DIR}/Modules/getpath.c + PROPERTY COMPILE_DEFINITIONS + PREFIX="${CMAKE_INSTALL_PREFIX}" + EXEC_PREFIX="${CMAKE_INSTALL_PREFIX}" + VERSION="${PY_VERSION_MAJOR}.${PY_VERSION_MINOR}" + VPATH="." + PYTHONPATH="${PYTHONPATH}" + ) endif() - set_property( - SOURCE ${SRC_DIR}/Modules/getpath.c - PROPERTY COMPILE_DEFINITIONS - PREFIX="${CMAKE_INSTALL_PREFIX}" - EXEC_PREFIX="${CMAKE_INSTALL_PREFIX}" - VERSION="${PY_VERSION_MAJOR}.${PY_VERSION_MINOR}" - VPATH="." - PYTHONPATH="${PYTHONPATH}" - ) elseif(WIN32) add_definitions(-DPY3_DLLNAME="python3${CMAKE_DEBUG_POSTFIX}") - add_definitions(-DPYTHON_DLL_NAME="python${PY_VERSION_MAJOR}${PY_VERSION_MINOR}") - list(APPEND MODULE_SOURCES - ${SRC_DIR}/PC/getpathp.c - ) - # HACK To workaround limitation in escaping logic of CMake, the pythonpath - # separator is conditionally set depending of the version of Visual Studio. - # See http://cmake.org/Bug/view.php?id=14073 - if( ("${MSVC_VERSION}" VERSION_GREATER "1599") AND ("${CMAKE_GENERATOR}" MATCHES "^Visual Studio") ) - set(PATHSEP "%3B") - elseif( (${MSVC}) AND ("${CMAKE_GENERATOR}" MATCHES "^Ninja") ) - set(PATHSEP "\;") - elseif( (${MSVC}) AND ("${CMAKE_GENERATOR}" MATCHES "^NMake") ) - set(PATHSEP "\;") - elseif(MINGW) - set(PATHSEP "\;") - else() - set(PATHSEP ";") - endif() - string(REPLACE "/" "\\\\" PYTHONHOME_ESCAPED ${PYTHONHOME}) - string(REPLACE "/" "\\\\" EXTENSION_INSTALL_DIR_ESCAPED ${EXTENSION_INSTALL_DIR}) - set(PYTHONPATH "${EXTRA_PYTHONPATH}") - set(PYTHONPATH "${PYTHONPATH}${PATHSEP}.\\\\${PYTHONHOME_ESCAPED}") - set(PYTHONPATH "${PYTHONPATH}${PATHSEP}.\\\\${EXTENSION_INSTALL_DIR_ESCAPED}") - set(PYTHONPATH "${PYTHONPATH}${PATHSEP}.\\\\${EXTENSION_INSTALL_DIR_ESCAPED}\\\\${CMAKE_CFG_INTDIR}") - set(PYTHONPATH "${PYTHONPATH}${PATHSEP}.\\\\${PYTHONHOME_ESCAPED}\\\\plat-${PY_PLATFORM}") - if(ENABLE_TKINTER) - set(PYTHONPATH "${PYTHONPATH}${PATHSEP}.\\\\${PYTHONHOME_ESCAPED}\\\\lib-tk") - endif() + if(PY_VERSION VERSION_LESS "3.11") + add_definitions(-DPYTHON_DLL_NAME="python${PY_VERSION_MAJOR}${PY_VERSION_MINOR}") + list(APPEND MODULE_SOURCES + ${SRC_DIR}/PC/getpathp.c + ) + # HACK To workaround limitation in escaping logic of CMake, the pythonpath + # separator is conditionally set depending of the version of Visual Studio. + # See http://cmake.org/Bug/view.php?id=14073 + if( ("${MSVC_VERSION}" VERSION_GREATER "1599") AND ("${CMAKE_GENERATOR}" MATCHES "^Visual Studio") ) + set(PATHSEP "%3B") + elseif( (${MSVC}) AND ("${CMAKE_GENERATOR}" MATCHES "^Ninja") ) + set(PATHSEP "\;") + elseif( (${MSVC}) AND ("${CMAKE_GENERATOR}" MATCHES "^NMake") ) + set(PATHSEP "\;") + elseif(MINGW) + set(PATHSEP "\;") + else() + set(PATHSEP ";") + endif() + string(REPLACE "/" "\\\\" PYTHONHOME_ESCAPED ${PYTHONHOME}) + string(REPLACE "/" "\\\\" EXTENSION_INSTALL_DIR_ESCAPED ${EXTENSION_INSTALL_DIR}) + set(PYTHONPATH "${EXTRA_PYTHONPATH}") + set(PYTHONPATH "${PYTHONPATH}${PATHSEP}.\\\\${PYTHONHOME_ESCAPED}") + set(PYTHONPATH "${PYTHONPATH}${PATHSEP}.\\\\${EXTENSION_INSTALL_DIR_ESCAPED}") + set(PYTHONPATH "${PYTHONPATH}${PATHSEP}.\\\\${EXTENSION_INSTALL_DIR_ESCAPED}\\\\${CMAKE_CFG_INTDIR}") + set(PYTHONPATH "${PYTHONPATH}${PATHSEP}.\\\\${PYTHONHOME_ESCAPED}\\\\plat-${PY_PLATFORM}") + if(ENABLE_TKINTER) + set(PYTHONPATH "${PYTHONPATH}${PATHSEP}.\\\\${PYTHONHOME_ESCAPED}\\\\lib-tk") + endif() - set(_wide_char_modifier) - if(IS_PY3) - set(_wide_char_modifier "L") - endif() + set(_wide_char_modifier) + if(IS_PY3) + set(_wide_char_modifier "L") + endif() - set_property( - SOURCE ${SRC_DIR}/PC/getpathp.c - PROPERTY COMPILE_DEFINITIONS - "LANDMARK=${_wide_char_modifier}\"${PYTHONHOME_ESCAPED}\\\\os.py\"" - "PYTHONPATH=${_wide_char_modifier}\"${PYTHONPATH}\"" - "PY3_DLLNAME=\"python3$<$:_d>\"" - ) + set_property( + SOURCE ${SRC_DIR}/PC/getpathp.c + PROPERTY COMPILE_DEFINITIONS + "LANDMARK=${_wide_char_modifier}\"${PYTHONHOME_ESCAPED}\\\\os.py\"" + "PYTHONPATH=${_wide_char_modifier}\"${PYTHONPATH}\"" + "PY3_DLLNAME=\"python3$<$:_d>\"" + ) + endif() endif() if(PY_VERSION VERSION_GREATER_EQUAL "3.10") @@ -79,6 +87,12 @@ if(PY_VERSION VERSION_GREATER_EQUAL "3.10") ${SRC_DIR}/Parser/token.c ${SRC_DIR}/Parser/tokenizer.c ) + if(PY_VERSION VERSION_GREATER_EQUAL "3.11") + list(APPEND PARSER_COMMON_SOURCES + ${SRC_DIR}/Parser/action_helpers.c + ${SRC_DIR}/Parser/pegen_errors.c + ) + endif() else() set(PARSER_COMMON_SOURCES # Equivalent to POBJS in Makefile.pre ${SRC_DIR}/Parser/acceler.c @@ -221,19 +235,24 @@ if(UNIX AND HAVE_DLOPEN) endif() elseif(WIN32) list(APPEND DYNLOAD_SOURCES - ${SRC_DIR}/PC/dl_nt.c ${SRC_DIR}/Python/dynload_win.c + ) + if(PY_VERSION VERSION_LESS "3.11") + list(APPEND DYNLOAD_SOURCES + ${SRC_DIR}/PC/dl_nt.c ) - set(ms_dll_id "${PY_VERSION_MAJOR}.${PY_VERSION_MINOR}") - if(${CMAKE_SIZEOF_VOID_P} EQUAL 4) - set(ms_dll_id "${ms_dll_id}-32") - endif() - set_property( - SOURCE ${SRC_DIR}/PC/dl_nt.c - PROPERTY COMPILE_DEFINITIONS - Py_ENABLE_SHARED - MS_DLL_ID="${ms_dll_id}" - ) + + set(ms_dll_id "${PY_VERSION_MAJOR}.${PY_VERSION_MINOR}") + if(${CMAKE_SIZEOF_VOID_P} EQUAL 4) + set(ms_dll_id "${ms_dll_id}-32") + endif() + set_property( + SOURCE ${SRC_DIR}/PC/dl_nt.c + PROPERTY COMPILE_DEFINITIONS + Py_ENABLE_SHARED + MS_DLL_ID="${ms_dll_id}" + ) + endif() endif() set(THREAD_SOURCES ) @@ -334,15 +353,24 @@ if(PY_VERSION VERSION_GREATER_EQUAL "3.10") ${SRC_DIR}/Python/suggestions.c ) endif() +if(PY_VERSION VERSION_GREATER_EQUAL "3.11") + list(APPEND PYTHON_COMMON_SOURCES + ${SRC_DIR}/Python/Python-tokenize.c + ${SRC_DIR}/Python/frame.c + ${SRC_DIR}/Python/specialize.c + ) +endif() if(UNIX) list(APPEND PYTHON_COMMON_SOURCES ${SRC_DIR}/Python/frozenmain.c ) else() - list(APPEND PYTHON_COMMON_SOURCES - ${SRC_DIR}/Python/frozen.c - ) + if(PY_VERSION VERSION_LESS "3.11") + list(APPEND PYTHON_COMMON_SOURCES + ${SRC_DIR}/Python/frozen.c + ) + endif() endif() if(UNIX OR MINGW) @@ -359,6 +387,13 @@ if(UNIX OR MINGW) ) endif() endif() +if(PY_VERSION VERSION_GREATER_EQUAL "3.11") + set_property( + SOURCE ${SRC_DIR}/Python/sysmodule.c + PROPERTY COMPILE_DEFINITIONS + VPATH="..\\\\.." + ) +endif() list(APPEND MODULE_SOURCES ${SRC_DIR}/Modules/signalmodule.c @@ -480,65 +515,312 @@ if(WIN32 AND IS_PY3) if(PY_VERSION VERSION_GREATER_EQUAL "3.9") list(APPEND LIBPYTHON_TARGET_LIBRARIES pathcch) endif() + if(PY_VERSION VERSION_GREATER_EQUAL "3.11") + list(APPEND LIBPYTHON_TARGET_LIBRARIES bcrypt) # Required by bootstrap_hash + endif() endif() set(LIBPYTHON_FROZEN_SOURCES ) +set(LIBPYTHON_DEEPFREEZE_SOURCES ) +if(PY_VERSION VERSION_GREATER_EQUAL "3.11") + set(LIBPYTHON_DEEPFREEZE_SOURCES + ${SRC_DIR}/Python/deepfreeze/deepfreeze.c + ) +endif() if(IS_PY3) # Build _freeze_importlib executable +if(PY_VERSION VERSION_GREATER_EQUAL "3.11") + set(_freeze_importlib_SOURCE + ${SRC_DIR}/Programs/_freeze_module.c + ${SRC_DIR}/Modules/getpath_noop.c + ) + if(WIN32) + list(APPEND _freeze_importlib_SOURCE + ${SRC_DIR}/PC/config_minimal.c + ) + set(ms_dll_id "${PY_VERSION_MAJOR}.${PY_VERSION_MINOR}") + if(${CMAKE_SIZEOF_VOID_P} EQUAL 4) + set(ms_dll_id "${ms_dll_id}-32") + endif() + set_property( + SOURCE ${SRC_DIR}/PC/config_minimal.c + PROPERTY COMPILE_DEFINITIONS + MS_DLL_ID="${ms_dll_id}" + ) + endif() +else() + set(_freeze_importlib_SOURCE ${SRC_DIR}/Programs/_freeze_importlib.c) +endif() add_executable(_freeze_importlib - ${SRC_DIR}/Programs/_freeze_importlib.c + ${_freeze_importlib_SOURCE} ${LIBPYTHON_OMIT_FROZEN_SOURCES} +) +if(CMAKE_DEBUG_POSTFIX) + set_target_properties(_freeze_importlib PROPERTIES + DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX} ) +endif() target_link_libraries(_freeze_importlib ${LIBPYTHON_TARGET_LIBRARIES}) if(builtin_compile_definitions_without_py_limited_api) target_compile_definitions(_freeze_importlib PUBLIC ${builtin_compile_definitions_without_py_limited_api}) endif() # Freeze modules -set(LIBPYTHON_FROZEN_SOURCES - ${SRC_DIR}/Python/importlib_external.h - ${SRC_DIR}/Python/importlib.h -) -if(PY_VERSION VERSION_GREATER_EQUAL "3.8") - list(APPEND LIBPYTHON_FROZEN_SOURCES - ${SRC_DIR}/Python/importlib_zipimport.h +if(PY_VERSION VERSION_LESS "3.11") + set(LIBPYTHON_FROZEN_SOURCES + ${SRC_DIR}/Python/importlib_external.h + ${SRC_DIR}/Python/importlib.h ) -endif() -add_custom_command( - OUTPUT ${LIBPYTHON_FROZEN_SOURCES} - COMMAND - ${CMAKE_CROSSCOMPILING_EMULATOR} $ - $<$:importlib._bootstrap_external> + if(PY_VERSION VERSION_GREATER_EQUAL "3.8") + list(APPEND LIBPYTHON_FROZEN_SOURCES + ${SRC_DIR}/Python/importlib_zipimport.h + ) + endif() + add_custom_command( + OUTPUT ${LIBPYTHON_FROZEN_SOURCES} + COMMAND + ${CMAKE_CROSSCOMPILING_EMULATOR} $ + $<$:importlib._bootstrap_external> + ${SRC_DIR}/Lib/importlib/_bootstrap_external.py + ${SRC_DIR}/Python/importlib_external.h + COMMAND + ${CMAKE_CROSSCOMPILING_EMULATOR} $ + $<$:importlib._bootstrap> + ${SRC_DIR}/Lib/importlib/_bootstrap.py + ${SRC_DIR}/Python/importlib.h + DEPENDS + _freeze_importlib ${SRC_DIR}/Lib/importlib/_bootstrap_external.py - ${SRC_DIR}/Python/importlib_external.h - COMMAND - ${CMAKE_CROSSCOMPILING_EMULATOR} $ - $<$:importlib._bootstrap> ${SRC_DIR}/Lib/importlib/_bootstrap.py - ${SRC_DIR}/Python/importlib.h - DEPENDS - _freeze_importlib - ${SRC_DIR}/Lib/importlib/_bootstrap_external.py - ${SRC_DIR}/Lib/importlib/_bootstrap.py -) -if(PY_VERSION VERSION_GREATER_EQUAL "3.8") + ) + if(PY_VERSION VERSION_GREATER_EQUAL "3.8") + add_custom_command( + OUTPUT ${LIBPYTHON_FROZEN_SOURCES} + COMMAND + ${CMAKE_CROSSCOMPILING_EMULATOR} $ + zipimport + ${SRC_DIR}/Lib/zipimport.py + ${SRC_DIR}/Python/importlib_zipimport.h + DEPENDS + ${SRC_DIR}/Lib/zipimport.py + APPEND + ) + endif() +else() + set(LIBPYTHON_FROZEN_SOURCES + ${SRC_DIR}/Python/frozen_modules/importlib._bootstrap.h + ${SRC_DIR}/Python/frozen_modules/importlib._bootstrap_external.h + ${SRC_DIR}/Python/frozen_modules/zipimport.h + ${SRC_DIR}/Python/frozen_modules/abc.h + ${SRC_DIR}/Python/frozen_modules/codecs.h + ${SRC_DIR}/Python/frozen_modules/io.h + ${SRC_DIR}/Python/frozen_modules/_collections_abc.h + ${SRC_DIR}/Python/frozen_modules/_sitebuiltins.h + ${SRC_DIR}/Python/frozen_modules/genericpath.h + ${SRC_DIR}/Python/frozen_modules/ntpath.h + ${SRC_DIR}/Python/frozen_modules/posixpath.h + ${SRC_DIR}/Python/frozen_modules/os.h + ${SRC_DIR}/Python/frozen_modules/site.h + ${SRC_DIR}/Python/frozen_modules/stat.h + ${SRC_DIR}/Python/frozen_modules/importlib.util.h + ${SRC_DIR}/Python/frozen_modules/importlib.machinery.h + ${SRC_DIR}/Python/frozen_modules/runpy.h + ${SRC_DIR}/Python/frozen_modules/__hello__.h + ${SRC_DIR}/Python/frozen_modules/__phello__.h + ${SRC_DIR}/Python/frozen_modules/__phello__.ham.h + ${SRC_DIR}/Python/frozen_modules/__phello__.ham.eggs.h + ${SRC_DIR}/Python/frozen_modules/__phello__.spam.h + ${SRC_DIR}/Python/frozen_modules/frozen_only.h + ${SRC_DIR}/Python/frozen_modules/getpath.h + ) add_custom_command( OUTPUT ${LIBPYTHON_FROZEN_SOURCES} + COMMAND + ${CMAKE_CROSSCOMPILING_EMULATOR} $ + importlib._bootstrap + ${SRC_DIR}/Lib/importlib/_bootstrap.py + ${SRC_DIR}/Python/frozen_modules/importlib._bootstrap.h + COMMAND + ${CMAKE_CROSSCOMPILING_EMULATOR} $ + importlib._bootstrap_external + ${SRC_DIR}/Lib/importlib/_bootstrap_external.py + ${SRC_DIR}/Python/frozen_modules/importlib._bootstrap_external.h COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ zipimport ${SRC_DIR}/Lib/zipimport.py - ${SRC_DIR}/Python/importlib_zipimport.h + ${SRC_DIR}/Python/frozen_modules/zipimport.h + COMMAND + ${CMAKE_CROSSCOMPILING_EMULATOR} $ + abc + ${SRC_DIR}/Lib/abc.py + ${SRC_DIR}/Python/frozen_modules/abc.h + COMMAND + ${CMAKE_CROSSCOMPILING_EMULATOR} $ + codecs + ${SRC_DIR}/Lib/codecs.py + ${SRC_DIR}/Python/frozen_modules/codecs.h + COMMAND + ${CMAKE_CROSSCOMPILING_EMULATOR} $ + io + ${SRC_DIR}/Lib/io.py + ${SRC_DIR}/Python/frozen_modules/io.h + COMMAND + ${CMAKE_CROSSCOMPILING_EMULATOR} $ + _collections_abc + ${SRC_DIR}/Lib/_collections_abc.py + ${SRC_DIR}/Python/frozen_modules/_collections_abc.h + COMMAND + ${CMAKE_CROSSCOMPILING_EMULATOR} $ + _sitebuiltins + ${SRC_DIR}/Lib/_sitebuiltins.py + ${SRC_DIR}/Python/frozen_modules/_sitebuiltins.h + COMMAND + ${CMAKE_CROSSCOMPILING_EMULATOR} $ + genericpath + ${SRC_DIR}/Lib/genericpath.py + ${SRC_DIR}/Python/frozen_modules/genericpath.h + COMMAND + ${CMAKE_CROSSCOMPILING_EMULATOR} $ + ntpath + ${SRC_DIR}/Lib/ntpath.py + ${SRC_DIR}/Python/frozen_modules/ntpath.h + COMMAND + ${CMAKE_CROSSCOMPILING_EMULATOR} $ + posixpath + ${SRC_DIR}/Lib/posixpath.py + ${SRC_DIR}/Python/frozen_modules/posixpath.h + COMMAND + ${CMAKE_CROSSCOMPILING_EMULATOR} $ + os + ${SRC_DIR}/Lib/os.py + ${SRC_DIR}/Python/frozen_modules/os.h + COMMAND + ${CMAKE_CROSSCOMPILING_EMULATOR} $ + site + ${SRC_DIR}/Lib/site.py + ${SRC_DIR}/Python/frozen_modules/site.h + COMMAND + ${CMAKE_CROSSCOMPILING_EMULATOR} $ + stat + ${SRC_DIR}/Lib/stat.py + ${SRC_DIR}/Python/frozen_modules/stat.h + COMMAND + ${CMAKE_CROSSCOMPILING_EMULATOR} $ + importlib.util + ${SRC_DIR}/Lib/importlib/util.py + ${SRC_DIR}/Python/frozen_modules/importlib.util.h + COMMAND + ${CMAKE_CROSSCOMPILING_EMULATOR} $ + importlib.machinery + ${SRC_DIR}/Lib/importlib/machinery.py + ${SRC_DIR}/Python/frozen_modules/importlib.machinery.h + COMMAND + ${CMAKE_CROSSCOMPILING_EMULATOR} $ + runpy + ${SRC_DIR}/Lib/runpy.py + ${SRC_DIR}/Python/frozen_modules/runpy.h + COMMAND + ${CMAKE_CROSSCOMPILING_EMULATOR} $ + __hello__ + ${SRC_DIR}/Lib/__hello__.py + ${SRC_DIR}/Python/frozen_modules/__hello__.h + COMMAND + ${CMAKE_CROSSCOMPILING_EMULATOR} $ + __phello__ + ${SRC_DIR}/Lib/__phello__/__init__.py + ${SRC_DIR}/Python/frozen_modules/__phello__.h + COMMAND + ${CMAKE_CROSSCOMPILING_EMULATOR} $ + __phello__.ham + ${SRC_DIR}/Lib/__phello__/ham/__init__.py + ${SRC_DIR}/Python/frozen_modules/__phello__.ham.h + COMMAND + ${CMAKE_CROSSCOMPILING_EMULATOR} $ + __phello__.ham.eggs + ${SRC_DIR}/Lib/__phello__/ham/eggs.py + ${SRC_DIR}/Python/frozen_modules/__phello__.ham.eggs.h + COMMAND + ${CMAKE_CROSSCOMPILING_EMULATOR} $ + __phello__.spam + ${SRC_DIR}/Lib/__phello__/spam.py + ${SRC_DIR}/Python/frozen_modules/__phello__.spam.h + COMMAND + ${CMAKE_CROSSCOMPILING_EMULATOR} $ + frozen_only + ${SRC_DIR}/Tools/freeze/flag.py + ${SRC_DIR}/Python/frozen_modules/frozen_only.h + COMMAND + ${CMAKE_CROSSCOMPILING_EMULATOR} $ + getpath + ${SRC_DIR}/Modules/getpath.py + ${SRC_DIR}/Python/frozen_modules/getpath.h DEPENDS + _freeze_importlib + ${SRC_DIR}/Lib/importlib/_bootstrap.py + ${SRC_DIR}/Lib/importlib/_bootstrap_external.py ${SRC_DIR}/Lib/zipimport.py - APPEND + ${SRC_DIR}/Lib/abc.py + ${SRC_DIR}/Lib/codecs.py + ${SRC_DIR}/Lib/io.py + ${SRC_DIR}/Lib/_collections_abc.py + ${SRC_DIR}/Lib/_sitebuiltins.py + ${SRC_DIR}/Lib/genericpath.py + ${SRC_DIR}/Lib/ntpath.py + ${SRC_DIR}/Lib/posixpath.py + ${SRC_DIR}/Lib/os.py + ${SRC_DIR}/Lib/site.py + ${SRC_DIR}/Lib/stat.py + ${SRC_DIR}/Lib/importlib/util.py + ${SRC_DIR}/Lib/importlib/machinery.py + ${SRC_DIR}/Lib/runpy.py + ${SRC_DIR}/Lib/__hello__.py + ${SRC_DIR}/Lib/__phello__/__init__.py + ${SRC_DIR}/Lib/__phello__/ham/__init__.py + ${SRC_DIR}/Lib/__phello__/ham/eggs.py + ${SRC_DIR}/Lib/__phello__/spam.py + ${SRC_DIR}/Tools/freeze/flag.py + ${SRC_DIR}/Modules/getpath.py + ) + + add_custom_command( + OUTPUT ${LIBPYTHON_DEEPFREEZE_SOURCES} + COMMAND + ${Python3_EXECUTABLE} ${SRC_DIR}/Tools/scripts/deepfreeze.py + "${SRC_DIR}/Python/frozen_modules/importlib._bootstrap.h:importlib._bootstrap" + "${SRC_DIR}/Python/frozen_modules/importlib._bootstrap_external.h:importlib._bootstrap_external" + "${SRC_DIR}/Python/frozen_modules/zipimport.h:zipimport" + "${SRC_DIR}/Python/frozen_modules/abc.h:abc" + "${SRC_DIR}/Python/frozen_modules/codecs.h:codecs" + "${SRC_DIR}/Python/frozen_modules/io.h:io" + "${SRC_DIR}/Python/frozen_modules/_collections_abc.h:_collections_abc" + "${SRC_DIR}/Python/frozen_modules/_sitebuiltins.h:_sitebuiltins" + "${SRC_DIR}/Python/frozen_modules/genericpath.h:genericpath" + "${SRC_DIR}/Python/frozen_modules/ntpath.h:ntpath" + "${SRC_DIR}/Python/frozen_modules/posixpath.h:posixpath" + "${SRC_DIR}/Python/frozen_modules/os.h:os" + "${SRC_DIR}/Python/frozen_modules/site.h:site" + "${SRC_DIR}/Python/frozen_modules/stat.h:stat" + "${SRC_DIR}/Python/frozen_modules/importlib.util.h:importlib.util" + "${SRC_DIR}/Python/frozen_modules/importlib.machinery.h:importlib.machinery" + "${SRC_DIR}/Python/frozen_modules/runpy.h:runpy" + "${SRC_DIR}/Python/frozen_modules/__hello__.h:__hello__" + "${SRC_DIR}/Python/frozen_modules/__phello__.h:__phello__" + "${SRC_DIR}/Python/frozen_modules/__phello__.ham.h:__phello__.ham" + "${SRC_DIR}/Python/frozen_modules/__phello__.ham.eggs.h:__phello__.ham.eggs" + "${SRC_DIR}/Python/frozen_modules/__phello__.spam.h:__phello__.spam" + "${SRC_DIR}/Python/frozen_modules/frozen_only.h:frozen_only" + "-o" "${LIBPYTHON_DEEPFREEZE_SOURCES}" + DEPENDS + ${SRC_DIR}/Tools/scripts/deepfreeze.py + ${LIBPYTHON_FROZEN_SOURCES} ) endif() # This is a convenience target allowing to regenerate # the frozen sources. -add_custom_target(freeze_modules DEPENDS ${LIBPYTHON_FROZEN_SOURCES}) +add_custom_target(freeze_modules DEPENDS ${LIBPYTHON_FROZEN_SOURCES} ${LIBPYTHON_DEEPFREEZE_SOURCES}) endif() @@ -571,7 +853,59 @@ set(LIBPYTHON_SOURCES ${LIBPYTHON_OMIT_FROZEN_SOURCES} ${LIBPYTHON_FROZEN_SOURCES} ) -if(UNIX) +if(PY_VERSION VERSION_GREATER_EQUAL "3.11") + list(APPEND LIBPYTHON_SOURCES + ${LIBPYTHON_DEEPFREEZE_SOURCES} + ${SRC_DIR}/Modules/getpath.c + ${SRC_DIR}/Modules/_typingmodule.c + ${SRC_DIR}/Python/frozen.c + ) + + if(WIN32) + list(APPEND LIBPYTHON_SOURCES + ${PROJECT_BINARY_DIR}/CMakeFiles/config.c + ${SRC_DIR}/PC/dl_nt.c + ) + + set_property( + SOURCE ${SRC_DIR}/Modules/getpath.c + PROPERTY COMPILE_DEFINITIONS + PREFIX=NULL + EXEC_PREFIX=NULL + VERSION="${PY_VERSION_MAJOR}.${PY_VERSION_MINOR}" + VPATH="..\\\\.." + PYDEBUGEXT="$<$:_d>" + PLATLIBDIR="DLLs" + PYTHONPATH="Lib\\\\lib-dynload" + ) + + set(ms_dll_id "${PY_VERSION_MAJOR}.${PY_VERSION_MINOR}") + if(${CMAKE_SIZEOF_VOID_P} EQUAL 4) + set(ms_dll_id "${ms_dll_id}-32") + endif() + set_property( + SOURCE ${SRC_DIR}/PC/dl_nt.c + PROPERTY COMPILE_DEFINITIONS + Py_ENABLE_SHARED + MS_DLL_ID="${ms_dll_id}" + ) + else() + set(PYTHONPATH "${EXTRA_PYTHONPATH}:lib-dynload:plat-${PY_PLATFORM}:lib/python${PY_VERSION_MAJOR}.${PY_VERSION_MINOR}") + if(ENABLE_TKINTER) + set(PYTHONPATH "${PYTHONPATH}:lib-tk") + endif() + set_property( + SOURCE ${SRC_DIR}/Modules/getpath.c + PROPERTY COMPILE_DEFINITIONS + PREFIX="${CMAKE_INSTALL_PREFIX}" + EXEC_PREFIX="${CMAKE_INSTALL_PREFIX}" + VERSION="${PY_VERSION_MAJOR}.${PY_VERSION_MINOR}" + VPATH=".." + PYTHONPATH="${PYTHONPATH}" + PLATLIBDIR="lib" + ) + endif() +elseif(UNIX) list(APPEND LIBPYTHON_SOURCES ${SRC_DIR}/Python/frozen.c ) diff --git a/patches/3.11/01-PC-config_minimal.patch b/patches/3.11/01-PC-config_minimal.patch new file mode 100644 index 0000000..61370cd --- /dev/null +++ b/patches/3.11/01-PC-config_minimal.patch @@ -0,0 +1,17 @@ +diff --git a/PC/config_minimal.c b/PC/config_minimal.c +index 928a4efd32..e541204c79 100644 +--- a/PC/config_minimal.c ++++ b/PC/config_minimal.c +@@ -8,6 +8,12 @@ + /* Define extern variables omitted from minimal builds */ + void *PyWin_DLLhModule = NULL; + ++#if !defined(MS_DLL_ID) ++# error MS_DLL_ID must be defined ++#endif ++ ++const char *PyWin_DLLVersionString = MS_DLL_ID; ++ + + extern PyObject* PyInit_faulthandler(void); + extern PyObject* PyInit__tracemalloc(void); diff --git a/patches/3.11/02-getpath-portable-prefix.patch b/patches/3.11/02-getpath-portable-prefix.patch new file mode 100644 index 0000000..fa5af29 --- /dev/null +++ b/patches/3.11/02-getpath-portable-prefix.patch @@ -0,0 +1,125 @@ +diff --git a/Modules/getpath.c b/Modules/getpath.c +index 5dbe57c950..47b67e4ccb 100644 +--- a/Modules/getpath.c ++++ b/Modules/getpath.c +@@ -9,6 +9,120 @@ + #include + #include + ++ ++#if defined(__linux__) || defined(__APPLE__) ++char _portable_python_path_sep = '/'; ++#else ++char _portable_python_path_sep = '\\'; ++#endif ++ ++static void _portable_python_trim_to_parent_directory(char* path) { ++ char* last_slash = strrchr(path, _portable_python_path_sep); ++ if (last_slash == NULL) { ++ fprintf(stderr, "Invalid path: No parent directory found\n"); ++ exit(EXIT_FAILURE); ++ } ++ ++ // Calculate the length of the parent directory excluding the trailing slash ++ size_t parent_dir_length = last_slash - path; ++ path[parent_dir_length] = '\0'; ++} ++ ++#ifdef __linux__ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++pthread_mutex_t portable_python_prefix_mutex = PTHREAD_MUTEX_INITIALIZER; ++char portable_python_prefix[PATH_MAX] = {0}; ++ ++static char* portable_python_get_install_prefix() { ++ pthread_mutex_lock(&portable_python_prefix_mutex); ++ ++ if (portable_python_prefix[0] != '\0') { ++ pthread_mutex_unlock(&portable_python_prefix_mutex); ++ return portable_python_prefix; ++ } ++ ++ // First, get the path of the running executable ++ ssize_t len = readlink("/proc/self/exe", portable_python_prefix, PATH_MAX); ++ if (len == -1) { ++ perror("Error getting executable path"); ++ exit(EXIT_FAILURE); ++ } ++ portable_python_prefix[len] = '\0'; // Null-terminate the string ++ ++ _portable_python_trim_to_parent_directory(portable_python_prefix); // bin directory ++ _portable_python_trim_to_parent_directory(portable_python_prefix); // root directory ++ ++ pthread_mutex_unlock(&portable_python_prefix_mutex); ++ return portable_python_prefix; ++} ++ ++#endif ++ ++#ifdef __APPLE__ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++pthread_mutex_t portable_python_prefix_mutex = PTHREAD_MUTEX_INITIALIZER; ++char portable_python_prefix[PATH_MAX] = {0}; ++ ++static char* portable_python_get_install_prefix() { ++ pthread_mutex_lock(&portable_python_prefix_mutex); ++ ++ if (portable_python_prefix[0] != '\0') { ++ pthread_mutex_unlock(&portable_python_prefix_mutex); ++ return portable_python_prefix; ++ } ++ ++ char path[PATH_MAX]; ++ uint32_t bufsize = PATH_MAX; ++ if (_NSGetExecutablePath(path, &bufsize) != 0) { ++ fprintf(stderr, "Error getting executable path\n"); ++ exit(EXIT_FAILURE); ++ } ++ ++ // Resolve symlink if necessary ++ if (realpath(path, portable_python_prefix) == NULL) { ++ perror("Error resolving symlink"); ++ exit(EXIT_FAILURE); ++ } ++ ++ _portable_python_trim_to_parent_directory(portable_python_prefix); // bin directory ++ _portable_python_trim_to_parent_directory(portable_python_prefix); // root directory ++ ++ pthread_mutex_unlock(&portable_python_prefix_mutex); ++ return portable_python_prefix; ++} ++ ++#endif ++ ++#if defined(__linux__) || defined(__APPLE__) ++ ++#ifdef PREFIX ++# undef PREFIX ++#endif ++ ++#ifdef EXEC_PREFIX ++# undef EXEC_PREFIX ++#endif ++ ++#define PREFIX (portable_python_get_install_prefix()) ++#define EXEC_PREFIX (portable_python_get_install_prefix()) ++ ++#endif ++ + #ifdef __APPLE__ + # include + #endif diff --git a/patches/3.11/03-sysconfig-build-vars.patch b/patches/3.11/03-sysconfig-build-vars.patch new file mode 100644 index 0000000..12101b3 --- /dev/null +++ b/patches/3.11/03-sysconfig-build-vars.patch @@ -0,0 +1,24 @@ +diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py +index daf9f00006..638aaa18b4 100644 +--- a/Lib/sysconfig.py ++++ b/Lib/sysconfig.py +@@ -466,6 +466,19 @@ def _generate_posix_vars(): + f.write('build_time_vars = ') + pprint.pprint(vars, stream=f) + ++ # fixup sysconfig to use dynamic paths for portable python ++ with open(destfile, 'r', encoding='utf8') as f: ++ varsfile = f.read() ++ if '# patched for portable python' not in varsfile: ++ varsfile = varsfile.replace(" '"+vars['prefix'], " f'{root}") ++ varsfile = varsfile.replace(" '-I"+vars['prefix'], " f'-I{root}") ++ varsfile = varsfile.replace(" \"'"+vars['prefix'], " f\"'{root}") ++ with open(destfile, 'w', encoding='utf8') as f: ++ f.write('# patched for portable python\n') ++ f.write('import sys\nimport os\n') ++ f.write('root = os.path.dirname(os.path.dirname(sys.executable))\n') ++ f.write(varsfile) ++ + # Create file used for sys.path fixup -- see Modules/getpath.c + with open('pybuilddir.txt', 'w', encoding='utf8') as f: + f.write(pybuilddir) diff --git a/patches/3.11/04-ssl.patch b/patches/3.11/04-ssl.patch new file mode 100644 index 0000000..06a16ba --- /dev/null +++ b/patches/3.11/04-ssl.patch @@ -0,0 +1,25 @@ +diff --git a/Lib/ssl.py b/Lib/ssl.py +index f386fa7831..31eb0c3d82 100644 +--- a/Lib/ssl.py ++++ b/Lib/ssl.py +@@ -119,6 +119,10 @@ + ) + from _ssl import _DEFAULT_CIPHERS, _OPENSSL_API_VERSION + ++if os.name == "nt": ++ _portable_python_certifi_path = os.path.join(sys.prefix, "Lib", "site-packages", "certifi", "cacert.pem") ++else: ++ _portable_python_certifi_path = os.path.join(sys.prefix, "lib", f"python{sys.version_info.major}.{sys.version_info.minor}", "site-packages", "certifi", "cacert.pem") + + _IntEnum._convert_( + '_SSLMethod', __name__, +@@ -762,6 +766,9 @@ def create_default_context(purpose=Purpose.SERVER_AUTH, *, cafile=None, + else: + raise ValueError(purpose) + ++ if cafile is None: ++ cafile = _portable_python_certifi_path ++ + if cafile or capath or cadata: + context.load_verify_locations(cafile, capath, cadata) + elif context.verify_mode != CERT_NONE: diff --git a/patches/3.11/05-sys-abiflags-default.patch b/patches/3.11/05-sys-abiflags-default.patch new file mode 100644 index 0000000..e231b3d --- /dev/null +++ b/patches/3.11/05-sys-abiflags-default.patch @@ -0,0 +1,13 @@ +diff --git a/Python/sysmodule.c b/Python/sysmodule.c +index 560a6805fe..02f6ea9281 100644 +--- a/Python/sysmodule.c ++++ b/Python/sysmodule.c +@@ -2948,6 +2948,8 @@ _PySys_InitCore(PyThreadState *tstate, PyObject *sysdict) + #endif + #ifdef ABIFLAGS + SET_SYS_FROM_STRING("abiflags", ABIFLAGS); ++#else ++ SET_SYS_FROM_STRING("abiflags", ""); + #endif + + /* version_info */ diff --git a/patches/3.11/06-PC-_msi.patch b/patches/3.11/06-PC-_msi.patch new file mode 100644 index 0000000..eee5911 --- /dev/null +++ b/patches/3.11/06-PC-_msi.patch @@ -0,0 +1,12 @@ +diff --git a/PC/_msi.c b/PC/_msi.c +index 3d4e4ef22c..959cadc3aa 100644 +--- a/PC/_msi.c ++++ b/PC/_msi.c +@@ -2,6 +2,7 @@ + * Copyright (C) 2005 Martin v. Löwis + * Licensed to PSF under a contributor agreement. + */ ++#define NEEDS_PY_IDENTIFIER + + #include + #include diff --git a/patches/3.11/07-getpath_noop-missing-stub.patch b/patches/3.11/07-getpath_noop-missing-stub.patch new file mode 100644 index 0000000..6c923f9 --- /dev/null +++ b/patches/3.11/07-getpath_noop-missing-stub.patch @@ -0,0 +1,14 @@ +diff --git a/Modules/getpath_noop.c b/Modules/getpath_noop.c +index c10e41d07f..16d75834c3 100644 +--- a/Modules/getpath_noop.c ++++ b/Modules/getpath_noop.c +@@ -8,3 +8,9 @@ _PyConfig_InitPathConfig(PyConfig *config, int compute_path_config) + { + return PyStatus_Error("path configuration is unsupported"); + } ++ ++PyObject * ++_Py_Get_Getpath_CodeObject(void) ++{ ++ return NULL; ++}