From 4f41202a5d4930b5d01aae5363c4314d741907f4 Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Mon, 14 Oct 2024 20:44:23 -0400 Subject: [PATCH 01/45] add 3.13.0 --- .github/workflows/CI.yml | 2 +- CMakeLists.txt | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index d0b9bf9..d21fd3a 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -20,7 +20,7 @@ jobs: strategy: fail-fast: true matrix: - python-version: [3.9.20, 3.10.15, 3.11.10, 3.12.7] + python-version: [3.9.20, 3.10.15, 3.11.10, 3.12.7, 3.13.0] os: [macos, ubuntu] include: - os: macos diff --git a/CMakeLists.txt b/CMakeLists.txt index 07fb0b0..f87fc60 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -326,6 +326,8 @@ set(_download_3.12.4_md5 "ead819dab6d165937138daa9e51ccb54") set(_download_3.12.5_md5 "d23d56b51d36a9d51b2b13d30c849d00") set(_download_3.12.6_md5 "c2f1dd5c8807ee50b778684b7958ee28") set(_download_3.12.7_md5 "5d0c0e4c6a022a87165a9addcd869109") +# 3.13.x +set(_download_3.13.0_md5 "c29f37220520ec6075fc37d4c62e178b") set(_extracted_dir "Python-${PY_VERSION}") From b1ed60194c37b9897e7805e230a81e62ddf39669 Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Mon, 14 Oct 2024 20:49:20 -0400 Subject: [PATCH 02/45] roll forward existing patches --- patches/3.13/01-PC-config_minimal.patch | 17 +++ patches/3.13/02-freebsd-errno.patch | 20 +++ patches/3.13/03-cosmo-sys-random.patch | 14 ++ patches/3.13/04-PC-_msi.patch | 12 ++ .../3.13/05-getpath_noop-missing-stub.patch | 14 ++ .../portable/01-getpath-portable-prefix.patch | 125 ++++++++++++++++++ .../portable/02-sysconfig-build-vars.patch | 24 ++++ .../portable/03-sysconfig-pkgconfig.patch | 59 +++++++++ patches/3.13/portable/04-ssl.patch | 26 ++++ 9 files changed, 311 insertions(+) create mode 100644 patches/3.13/01-PC-config_minimal.patch create mode 100644 patches/3.13/02-freebsd-errno.patch create mode 100644 patches/3.13/03-cosmo-sys-random.patch create mode 100644 patches/3.13/04-PC-_msi.patch create mode 100644 patches/3.13/05-getpath_noop-missing-stub.patch create mode 100644 patches/3.13/portable/01-getpath-portable-prefix.patch create mode 100644 patches/3.13/portable/02-sysconfig-build-vars.patch create mode 100644 patches/3.13/portable/03-sysconfig-pkgconfig.patch create mode 100644 patches/3.13/portable/04-ssl.patch diff --git a/patches/3.13/01-PC-config_minimal.patch b/patches/3.13/01-PC-config_minimal.patch new file mode 100644 index 0000000..11f3272 --- /dev/null +++ b/patches/3.13/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.13/02-freebsd-errno.patch b/patches/3.13/02-freebsd-errno.patch new file mode 100644 index 0000000..6c828db --- /dev/null +++ b/patches/3.13/02-freebsd-errno.patch @@ -0,0 +1,20 @@ +diff --git a/Include/Python.h b/Include/Python.h +index 52a7aac6ba..c09deb9223 100644 +--- a/Include/Python.h ++++ b/Include/Python.h +@@ -22,7 +22,15 @@ + #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 + # include + # include // FILE* ++# if defined(__FreeBSD__) && defined(_POSIX_SOURCE) ++# define _WANT_POSIX_SOURCE ++# undef _POSIX_SOURCE ++# endif + # include // errno ++# if defined(_WANT_POSIX_SOURCE) ++# define _POSIX_SOURCE ++# undef _WANT_POSIX_SOURCE ++# endif + # include // memcpy() + #endif + #ifndef MS_WINDOWS diff --git a/patches/3.13/03-cosmo-sys-random.patch b/patches/3.13/03-cosmo-sys-random.patch new file mode 100644 index 0000000..9c2c02c --- /dev/null +++ b/patches/3.13/03-cosmo-sys-random.patch @@ -0,0 +1,14 @@ +diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c +index bd2a7fbf53..ed39ee6615 100644 +--- a/Modules/posixmodule.c ++++ b/Modules/posixmodule.c +@@ -321,6 +321,9 @@ corresponding Unix manual entries for more information on calls."); + #ifdef HAVE_LINUX_RANDOM_H + # include + #endif ++#if defined(HAVE_SYS_RANDOM_H) && defined(__COSMOPOLITAN__) ++# include ++#endif + #ifdef HAVE_GETRANDOM_SYSCALL + # include + #endif diff --git a/patches/3.13/04-PC-_msi.patch b/patches/3.13/04-PC-_msi.patch new file mode 100644 index 0000000..52c40e6 --- /dev/null +++ b/patches/3.13/04-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.13/05-getpath_noop-missing-stub.patch b/patches/3.13/05-getpath_noop-missing-stub.patch new file mode 100644 index 0000000..3a0f101 --- /dev/null +++ b/patches/3.13/05-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; ++} diff --git a/patches/3.13/portable/01-getpath-portable-prefix.patch b/patches/3.13/portable/01-getpath-portable-prefix.patch new file mode 100644 index 0000000..fa5af29 --- /dev/null +++ b/patches/3.13/portable/01-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.13/portable/02-sysconfig-build-vars.patch b/patches/3.13/portable/02-sysconfig-build-vars.patch new file mode 100644 index 0000000..12101b3 --- /dev/null +++ b/patches/3.13/portable/02-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.13/portable/03-sysconfig-pkgconfig.patch b/patches/3.13/portable/03-sysconfig-pkgconfig.patch new file mode 100644 index 0000000..c4acd6a --- /dev/null +++ b/patches/3.13/portable/03-sysconfig-pkgconfig.patch @@ -0,0 +1,59 @@ +diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py +index ebe3711827..d2a1716a1c 100644 +--- a/Lib/sysconfig.py ++++ b/Lib/sysconfig.py +@@ -847,5 +847,54 @@ def _main(): + _print_dict('Variables', get_config_vars()) + + ++# Patch the included pkgconfig files to use the prefix computed during ++# runtime. This is a hack for mesonbuild, which looks for Python using ++# pkgconfig. Since a portable Python installation can be moved around, ++# we have to fix the pkgconfig files to use the correct prefix. ++def portable_python_fixup_pkgconfig(): ++ vars = get_config_vars() ++ ++ pkgcfgdir = vars.get('LIBPC') ++ prefix = vars.get('prefix') ++ if pkgcfgdir and os.path.isdir(pkgcfgdir): ++ import tempfile ++ import hashlib ++ tempdir_root = tempfile.gettempdir() ++ suffix = hashlib.md5(sys.version.encode('utf-8')).hexdigest() ++ portable_python_tempdir = os.path.join(tempdir_root, f'.portable-python-{suffix}') ++ portable_python_pkgconfig = os.path.join(portable_python_tempdir, 'lib/pkgconfig') ++ ++ if pkgcfgdir == portable_python_pkgconfig: ++ return ++ ++ os.makedirs(portable_python_pkgconfig, exist_ok=True) ++ ++ for root, dirs, files in os.walk(pkgcfgdir): ++ for file in files: ++ if file.endswith('.pc'): ++ with open(os.path.join(root, file), 'r', encoding='utf8') as f: ++ data = f.read() ++ for line in data.split('\n'): ++ if line.startswith('prefix=') and line != f'prefix={prefix}': ++ data = data.replace(line, f'prefix={prefix}') ++ break ++ if not os.path.exists(os.path.join(portable_python_pkgconfig, file)): ++ with open(os.path.join(portable_python_pkgconfig, file), 'w+', encoding='utf8') as f: ++ f.write(data) ++ else: ++ with open(os.path.join(portable_python_pkgconfig, file), 'r', encoding='utf8') as f: ++ tempdata = f.read() ++ if tempdata != data: ++ with open(os.path.join(portable_python_pkgconfig, file), 'w', encoding='utf8') as f: ++ f.write(data) ++ ++ _CONFIG_VARS['LIBPC'] = portable_python_pkgconfig ++ ++try: ++ portable_python_fixup_pkgconfig() ++except: ++ pass ++ ++ + if __name__ == '__main__': + _main() diff --git a/patches/3.13/portable/04-ssl.patch b/patches/3.13/portable/04-ssl.patch new file mode 100644 index 0000000..c772c94 --- /dev/null +++ b/patches/3.13/portable/04-ssl.patch @@ -0,0 +1,26 @@ +diff --git a/Lib/ssl.py b/Lib/ssl.py +index cb5ec51681..43ae9889e6 100644 +--- a/Lib/ssl.py ++++ b/Lib/ssl.py +@@ -119,6 +119,10 @@ from _ssl import ( + ) + 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__, +@@ -742,6 +746,10 @@ def create_default_context(purpose=Purpose.SERVER_AUTH, *, cafile=None, + context.verify_mode = CERT_REQUIRED + context.check_hostname = True + ++ if cafile is None: ++ if os.path.exists(_portable_python_certifi_path): ++ cafile = _portable_python_certifi_path ++ + if cafile or capath or cadata: + context.load_verify_locations(cafile, capath, cadata) + elif context.verify_mode != CERT_NONE: From 3da020f0a5de095784e870a993251745de9c1122 Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Mon, 14 Oct 2024 20:50:14 -0400 Subject: [PATCH 03/45] run_tests.py was removed in 3.13 --- cmake/tools/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/tools/CMakeLists.txt b/cmake/tools/CMakeLists.txt index f0b0350..81cfe54 100644 --- a/cmake/tools/CMakeLists.txt +++ b/cmake/tools/CMakeLists.txt @@ -1,6 +1,6 @@ set(files) -if(PY_VERSION VERSION_GREATER_EQUAL "3.6") +if(PY_VERSION VERSION_GREATER_EQUAL "3.6" AND PY_VERSION VERSION_LESS "3.13") list(APPEND files Tools/scripts/run_tests.py ) From c8161512ee3bbb7f540a7a9c069b134d4138aeba Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Mon, 14 Oct 2024 20:54:37 -0400 Subject: [PATCH 04/45] update freebsd patch --- patches/3.13/02-freebsd-errno.patch | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/patches/3.13/02-freebsd-errno.patch b/patches/3.13/02-freebsd-errno.patch index 6c828db..040cd69 100644 --- a/patches/3.13/02-freebsd-errno.patch +++ b/patches/3.13/02-freebsd-errno.patch @@ -1,11 +1,11 @@ diff --git a/Include/Python.h b/Include/Python.h -index 52a7aac6ba..c09deb9223 100644 +index fb2d32d7110..4b8bf901bdf 100644 --- a/Include/Python.h +++ b/Include/Python.h -@@ -22,7 +22,15 @@ +@@ -33,7 +33,15 @@ + // The and headers are not included by limited C API + // version 3.13 and newer. #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 - # include - # include // FILE* +# if defined(__FreeBSD__) && defined(_POSIX_SOURCE) +# define _WANT_POSIX_SOURCE +# undef _POSIX_SOURCE @@ -15,6 +15,6 @@ index 52a7aac6ba..c09deb9223 100644 +# define _POSIX_SOURCE +# undef _WANT_POSIX_SOURCE +# endif + # include // FILE* + # include // getenv() # include // memcpy() - #endif - #ifndef MS_WINDOWS From bd618fb9d808fb9267c650922f6f64bd653b52b4 Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Mon, 14 Oct 2024 20:56:59 -0400 Subject: [PATCH 05/45] _msi.c removed in 3.13 --- patches/3.13/04-PC-_msi.patch | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 patches/3.13/04-PC-_msi.patch diff --git a/patches/3.13/04-PC-_msi.patch b/patches/3.13/04-PC-_msi.patch deleted file mode 100644 index 52c40e6..0000000 --- a/patches/3.13/04-PC-_msi.patch +++ /dev/null @@ -1,12 +0,0 @@ -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 From a0b84441108f9a6bbf3790fbc279b030218a6b71 Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Thu, 12 Dec 2024 10:27:57 -0500 Subject: [PATCH 06/45] disable other versions --- .github/workflows/CI.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index a6f72ec..00f953c 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -17,7 +17,8 @@ jobs: strategy: fail-fast: true matrix: - python-version: [3.9.21, 3.10.16, 3.11.11, 3.12.8, 3.13.0] + #python-version: [3.9.21, 3.10.16, 3.11.11, 3.12.8, 3.13.0] + python-version: [3.13.0] os: [ubuntu] include: - os: ubuntu From d8418e39b0be14b6aa389677af92ec65d8a85adb Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Thu, 12 Dec 2024 10:31:22 -0500 Subject: [PATCH 07/45] roll patches forward --- ...tch => 04-getpath_noop-missing-stub.patch} | 0 patches/3.13/05-solaris-fcntlmodule.patch | 20 +++++++++++++++++++ 2 files changed, 20 insertions(+) rename patches/3.13/{05-getpath_noop-missing-stub.patch => 04-getpath_noop-missing-stub.patch} (100%) create mode 100644 patches/3.13/05-solaris-fcntlmodule.patch diff --git a/patches/3.13/05-getpath_noop-missing-stub.patch b/patches/3.13/04-getpath_noop-missing-stub.patch similarity index 100% rename from patches/3.13/05-getpath_noop-missing-stub.patch rename to patches/3.13/04-getpath_noop-missing-stub.patch diff --git a/patches/3.13/05-solaris-fcntlmodule.patch b/patches/3.13/05-solaris-fcntlmodule.patch new file mode 100644 index 0000000..f0c2cff --- /dev/null +++ b/patches/3.13/05-solaris-fcntlmodule.patch @@ -0,0 +1,20 @@ +diff --git a/Modules/fcntlmodule.c b/Modules/fcntlmodule.c +index 2bca40213c6..59dab31bc40 100644 +--- a/Modules/fcntlmodule.c ++++ b/Modules/fcntlmodule.c +@@ -628,6 +628,15 @@ all_ins(PyObject* m) + #endif + + #ifdef HAVE_STROPTS_H ++ ++#if defined(sun) || defined(__sun) ++ #ifndef STR ++ /* for some reason, the preprocessor does not resolve this symbol */ ++ /* from /usr/include/sys/stropts.h on Solaris 11 */ ++ #define STR ('S'<<8) ++ #endif ++#endif ++ + /* Unix 98 guarantees that these are in stropts.h. */ + if (PyModule_AddIntMacro(m, I_PUSH)) return -1; + if (PyModule_AddIntMacro(m, I_POP)) return -1; From 001f7e095c617e6c7acbb8a899e5b4dc11f05dec Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Thu, 12 Dec 2024 10:39:45 -0500 Subject: [PATCH 08/45] remove dead batteries modules --- cmake/extensions/CMakeLists.txt | 24 ++++++++++++++++-------- cmake/libpython/CMakeLists.txt | 6 +++++- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/cmake/extensions/CMakeLists.txt b/cmake/extensions/CMakeLists.txt index 0b33dbc..4aebb1b 100644 --- a/cmake/extensions/CMakeLists.txt +++ b/cmake/extensions/CMakeLists.txt @@ -16,7 +16,9 @@ if(Cosmopolitan) 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}) +if(PY_VERSION VERSION_LESS "3.13") + add_python_extension(audioop ${WIN32_BUILTIN} REQUIRES HAVE_LIBM SOURCES audioop.c LIBRARIES ${M_LIBRARIES}) +endif() 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(_codecs_cn ${WIN32_BUILTIN} SOURCES cjkcodecs/_codecs_cn.c) @@ -27,11 +29,13 @@ add_python_extension(_codecs_kr ${WIN32_BUILTIN} SOURCES cjkcodecs/_codecs_kr.c) add_python_extension(_codecs_tw ${WIN32_BUILTIN} SOURCES cjkcodecs/_codecs_tw.c) add_python_extension(_collections ${WIN32_BUILTIN} ${PY3_BUILTIN} SOURCES _collectionsmodule.c) # Container types add_python_extension(cPickle ${WIN32_BUILTIN} REQUIRES IS_PY2 SOURCES cPickle.c) -set(crypt2_NAME crypt) -set(crypt2_SOURCES cryptmodule.c) -set(crypt3_NAME _crypt) -set(crypt3_SOURCES _cryptmodule.c) -add_python_extension(${crypt${PY_VERSION_MAJOR}_NAME} REQUIRES HAVE_LIBCRYPT SOURCES ${crypt${PY_VERSION_MAJOR}_SOURCES} LIBRARIES ${HAVE_LIBCRYPT}) +if(PY_VERSION VERSION_LESS "3.13") + set(crypt2_NAME crypt) + set(crypt2_SOURCES cryptmodule.c) + set(crypt3_NAME _crypt) + set(crypt3_SOURCES _cryptmodule.c) + add_python_extension(${crypt${PY_VERSION_MAJOR}_NAME} REQUIRES HAVE_LIBCRYPT SOURCES ${crypt${PY_VERSION_MAJOR}_SOURCES} LIBRARIES ${HAVE_LIBCRYPT}) +endif() add_python_extension(cStringIO ${WIN32_BUILTIN} REQUIRES IS_PY2 SOURCES cStringIO.c) add_python_extension(_csv ${WIN32_BUILTIN} SOURCES _csv.c) add_python_extension(_ctypes_test NEVER_BUILTIN REQUIRES HAVE_LIBM SOURCES _ctypes/_ctypes_test.c LIBRARIES ${M_LIBRARIES}) @@ -247,7 +251,9 @@ add_python_extension(nis add_python_extension(posix REQUIRES UNIX ALWAYS_BUILTIN SOURCES posixmodule.c DEFINITIONS Py_BUILD_CORE) add_python_extension(pwd REQUIRES UNIX BUILTIN SOURCES pwdmodule.c) # this is needed to find out the user's home dir if $HOME is not set add_python_extension(resource REQUIRES UNIX SOURCES resource.c) -add_python_extension(spwd REQUIRES UNIX HAVE_GETSPNAM HAVE_GETSPENT SOURCES spwdmodule.c) +if(PY_VERSION VERSION_LESS "3.13") + add_python_extension(spwd REQUIRES UNIX HAVE_GETSPNAM HAVE_GETSPENT SOURCES spwdmodule.c) +endif() add_python_extension(syslog REQUIRES UNIX SOURCES syslogmodule.c) add_python_extension(termios REQUIRES UNIX SOURCES termios.c) @@ -266,7 +272,9 @@ add_python_extension(_scproxy # Linux-only extensions add_python_extension(linuxaudiodev REQUIRES LINUX IS_PY2 NOT_COSMOPOLITAN SOURCES linuxaudiodev.c) -add_python_extension(ossaudiodev REQUIRES LINUX NOT_COSMOPOLITAN SOURCES ossaudiodev.c) +if(PY_VERSION VERSION_LESS "3.13") + add_python_extension(ossaudiodev REQUIRES LINUX NOT_COSMOPOLITAN SOURCES ossaudiodev.c) +endif() # Python 3.8: UNIX-only extensions if(PY_VERSION VERSION_GREATER_EQUAL "3.8") diff --git a/cmake/libpython/CMakeLists.txt b/cmake/libpython/CMakeLists.txt index fc6b22b..3e8fa73 100644 --- a/cmake/libpython/CMakeLists.txt +++ b/cmake/libpython/CMakeLists.txt @@ -206,8 +206,12 @@ set(OBJECT_COMMON_SOURCES # Equivalent to OBJECT_OBJS in Makefile.pre ${SRC_DIR}/Objects/weakrefobject.c ) if(PY_VERSION VERSION_GREATER_EQUAL "3.8") + if(PY_VERSION VERSION_LESS "3.13") + list(APPEND OBJECT_COMMON_SOURCES + ${SRC_DIR}/Objects/interpreteridobject.c + ) + endif() list(APPEND OBJECT_COMMON_SOURCES - ${SRC_DIR}/Objects/interpreteridobject.c ${SRC_DIR}/Objects/picklebufobject.c ) endif() From d718c4b36cc8d1bda5e864e22c88bf74bdede876 Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Thu, 12 Dec 2024 10:53:05 -0500 Subject: [PATCH 09/45] update tokenizer sources --- cmake/extensions/CMakeLists.txt | 86 ++++++++++++++++++--------------- cmake/libpython/CMakeLists.txt | 13 ++++- 2 files changed, 58 insertions(+), 41 deletions(-) diff --git a/cmake/extensions/CMakeLists.txt b/cmake/extensions/CMakeLists.txt index 4aebb1b..6c94876 100644 --- a/cmake/extensions/CMakeLists.txt +++ b/cmake/extensions/CMakeLists.txt @@ -89,40 +89,44 @@ add_python_extension(strop ${WIN32_BUILTIN} REQUIRES IS_PY2 SOURCES stropmodule. add_python_extension(_struct ${WIN32_BUILTIN} SOURCES _struct.c) set(testcapi_SOURCES _testcapimodule.c) if(PY_VERSION VERSION_GREATER_EQUAL "3.12") - list(APPEND testcapi_SOURCES - _testcapi/abstract.c - _testcapi/buffer.c - _testcapi/bytearray.c - _testcapi/bytes.c - _testcapi/code.c - _testcapi/codec.c - _testcapi/complex.c - _testcapi/datetime.c - _testcapi/dict.c - _testcapi/docstring.c - _testcapi/exceptions.c - _testcapi/file.c - _testcapi/float.c - _testcapi/gc.c - _testcapi/getargs.c - _testcapi/heaptype.c - _testcapi/heaptype_relative.c - _testcapi/immortal.c - _testcapi/list.c - _testcapi/long.c - _testcapi/mem.c - _testcapi/numbers.c - _testcapi/pyos.c - _testcapi/pytime.c - _testcapi/set.c - _testcapi/structmember.c - _testcapi/sys.c - _testcapi/tuple.c - _testcapi/unicode.c - _testcapi/vectorcall.c - _testcapi/vectorcall_limited.c - _testcapi/watchers.c - ) + if(PY_VERSION VERSION_LESS "3.13") + list(APPEND testcapi_SOURCES + _testcapi/bytearray.c + ) + endif() + list(APPEND testcapi_SOURCES + _testcapi/abstract.c + _testcapi/buffer.c + _testcapi/bytes.c + _testcapi/code.c + _testcapi/codec.c + _testcapi/complex.c + _testcapi/datetime.c + _testcapi/dict.c + _testcapi/docstring.c + _testcapi/exceptions.c + _testcapi/file.c + _testcapi/float.c + _testcapi/gc.c + _testcapi/getargs.c + _testcapi/heaptype.c + _testcapi/heaptype_relative.c + _testcapi/immortal.c + _testcapi/list.c + _testcapi/long.c + _testcapi/mem.c + _testcapi/numbers.c + _testcapi/pyos.c + _testcapi/pytime.c + _testcapi/set.c + _testcapi/structmember.c + _testcapi/sys.c + _testcapi/tuple.c + _testcapi/unicode.c + _testcapi/vectorcall.c + _testcapi/vectorcall_limited.c + _testcapi/watchers.c + ) endif() if(PY_VERSION VERSION_LESS "3.12" OR UNIX) # This module seems to build incorrectly for Python 3.12 Windows @@ -241,12 +245,14 @@ if(TIRPC_LIBRARY AND TIRPC_RPC_INCLUDE_PATH) list(APPEND nis_LIBRARIES ${TIRPC_STATIC_LIBRARIES}) endif() endif() -add_python_extension(nis - REQUIRES ${nis_REQUIRES} - SOURCES nismodule.c - LIBRARIES ${nis_LIBRARIES} - INCLUDEDIRS ${nis_INCLUDEDIRS} -) +if(PY_VERSION VERSION_LESS "3.13") + add_python_extension(nis + REQUIRES ${nis_REQUIRES} + SOURCES nismodule.c + LIBRARIES ${nis_LIBRARIES} + INCLUDEDIRS ${nis_INCLUDEDIRS} + ) +endif() add_python_extension(posix REQUIRES UNIX ALWAYS_BUILTIN SOURCES posixmodule.c DEFINITIONS Py_BUILD_CORE) add_python_extension(pwd REQUIRES UNIX BUILTIN SOURCES pwdmodule.c) # this is needed to find out the user's home dir if $HOME is not set diff --git a/cmake/libpython/CMakeLists.txt b/cmake/libpython/CMakeLists.txt index 3e8fa73..5611793 100644 --- a/cmake/libpython/CMakeLists.txt +++ b/cmake/libpython/CMakeLists.txt @@ -85,8 +85,19 @@ if(PY_VERSION VERSION_GREATER_EQUAL "3.10") ${SRC_DIR}/Parser/pegen.c ${SRC_DIR}/Parser/string_parser.c ${SRC_DIR}/Parser/token.c - ${SRC_DIR}/Parser/tokenizer.c ) + if(PY_VERSION VERSION_GREATER_EQUAL "3.13") + list(APPEND PARSER_COMMON_SOURCES + ${SRC_DIR}/Parser/tokenizer/string_tokenizer.c + ${SRC_DIR}/Parser/tokenizer/readline_tokenizer.c + ${SRC_DIR}/Parser/tokenizer/utf8_tokenizer.c + ${SRC_DIR}/Parser/tokenizer/file_tokenizer.c + ) + else() + list(APPEND PARSER_COMMON_SOURCES + ${SRC_DIR}/Parser/tokenizer.c + ) + endif() if(PY_VERSION VERSION_GREATER_EQUAL "3.11") list(APPEND PARSER_COMMON_SOURCES ${SRC_DIR}/Parser/action_helpers.c From f5da9246958ed5f3b83a99a75d6e4e3830208b9f Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Thu, 12 Dec 2024 10:58:47 -0500 Subject: [PATCH 10/45] update _testcapi --- cmake/extensions/CMakeLists.txt | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/cmake/extensions/CMakeLists.txt b/cmake/extensions/CMakeLists.txt index 6c94876..42e514f 100644 --- a/cmake/extensions/CMakeLists.txt +++ b/cmake/extensions/CMakeLists.txt @@ -92,6 +92,17 @@ if(PY_VERSION VERSION_GREATER_EQUAL "3.12") if(PY_VERSION VERSION_LESS "3.13") list(APPEND testcapi_SOURCES _testcapi/bytearray.c + _testcapi/heaptype_relative.c + _testcapi/pyos.c + _testcapi/pytime.c + _testcapi/vectorcall_limited.c + ) + else() + list(APPEND testcapi_SOURCES + _testcapi/hash.c + _testcapi/pyatomic.c + _testcapi/run.c + _testcapi/time.c ) endif() list(APPEND testcapi_SOURCES @@ -110,21 +121,17 @@ if(PY_VERSION VERSION_GREATER_EQUAL "3.12") _testcapi/gc.c _testcapi/getargs.c _testcapi/heaptype.c - _testcapi/heaptype_relative.c _testcapi/immortal.c _testcapi/list.c _testcapi/long.c _testcapi/mem.c _testcapi/numbers.c - _testcapi/pyos.c - _testcapi/pytime.c _testcapi/set.c _testcapi/structmember.c _testcapi/sys.c _testcapi/tuple.c _testcapi/unicode.c _testcapi/vectorcall.c - _testcapi/vectorcall_limited.c _testcapi/watchers.c ) endif() From 7dd153124b2eb1de1523a393559c31b5d9f1facf Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Thu, 12 Dec 2024 11:02:01 -0500 Subject: [PATCH 11/45] update sources --- cmake/extensions/CMakeLists.txt | 2 +- cmake/libpython/CMakeLists.txt | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cmake/extensions/CMakeLists.txt b/cmake/extensions/CMakeLists.txt index 42e514f..298c484 100644 --- a/cmake/extensions/CMakeLists.txt +++ b/cmake/extensions/CMakeLists.txt @@ -95,6 +95,7 @@ if(PY_VERSION VERSION_GREATER_EQUAL "3.12") _testcapi/heaptype_relative.c _testcapi/pyos.c _testcapi/pytime.c + _testcapi/sys.c _testcapi/vectorcall_limited.c ) else() @@ -128,7 +129,6 @@ if(PY_VERSION VERSION_GREATER_EQUAL "3.12") _testcapi/numbers.c _testcapi/set.c _testcapi/structmember.c - _testcapi/sys.c _testcapi/tuple.c _testcapi/unicode.c _testcapi/vectorcall.c diff --git a/cmake/libpython/CMakeLists.txt b/cmake/libpython/CMakeLists.txt index 5611793..d9c1aca 100644 --- a/cmake/libpython/CMakeLists.txt +++ b/cmake/libpython/CMakeLists.txt @@ -953,12 +953,16 @@ elseif(UNIX) ) endif() if(PY_VERSION VERSION_GREATER_EQUAL "3.12") + if(PY_VERSION VERSION_LESS "3.13") + list(APPEND LIBPYTHON_SOURCES + ${SRC_DIR}/Modules/_xxinterpchannelsmodule.c + ) + endif() list(APPEND LIBPYTHON_SOURCES ${SRC_DIR}/Modules/_hacl/Hacl_Hash_MD5.c ${SRC_DIR}/Modules/_hacl/Hacl_Hash_SHA1.c ${SRC_DIR}/Modules/_hacl/Hacl_Hash_SHA2.c ${SRC_DIR}/Modules/_hacl/Hacl_Hash_SHA3.c - ${SRC_DIR}/Modules/_xxinterpchannelsmodule.c ${SRC_DIR}/Modules/md5module.c ${SRC_DIR}/Modules/sha1module.c ${SRC_DIR}/Modules/sha2module.c From 5e629a6bb5d289c03abfb0ee66b28cf0faa9b9ac Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Thu, 12 Dec 2024 11:07:47 -0500 Subject: [PATCH 12/45] detect various ncurses headers --- cmake/ConfigureChecks.cmake | 1 + cmake/config-unix/pyconfig.h.in | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/cmake/ConfigureChecks.cmake b/cmake/ConfigureChecks.cmake index 05d99a6..3d6ab92 100644 --- a/cmake/ConfigureChecks.cmake +++ b/cmake/ConfigureChecks.cmake @@ -326,6 +326,7 @@ check_include_files(memory.h HAVE_MEMORY_H) # libffi and cpython check_include_files(minix/config.h HAVE_MINIX_CONFIG_H) check_include_files(ncurses.h HAVE_NCURSES_H) check_include_files(ncurses/panel.h HAVE_NCURSES_PANEL_H) +check_include_files(ncursesw/panel.h HAVE_NCURSESW_PANEL_H) check_include_files(netdb.h HAVE_NETDB_H) check_include_files(netinet/in.h HAVE_NETINET_IN_H) check_include_files(netpacket/packet.h HAVE_NETPACKET_PACKET_H) diff --git a/cmake/config-unix/pyconfig.h.in b/cmake/config-unix/pyconfig.h.in index 8102789..813dc52 100644 --- a/cmake/config-unix/pyconfig.h.in +++ b/cmake/config-unix/pyconfig.h.in @@ -813,6 +813,15 @@ /* 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_NCURSES_PANEL_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_NCURSESW_PANEL_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_PANEL_H 1 + /* Define to 1 if you have the header file. */ #cmakedefine HAVE_NETDB_H 1 From e2b08e52494ad1f5985acb076760ac4d3c9b742b Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Thu, 12 Dec 2024 11:14:33 -0500 Subject: [PATCH 13/45] add missing sources --- cmake/libpython/CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmake/libpython/CMakeLists.txt b/cmake/libpython/CMakeLists.txt index d9c1aca..a9a75a8 100644 --- a/cmake/libpython/CMakeLists.txt +++ b/cmake/libpython/CMakeLists.txt @@ -396,6 +396,14 @@ if(PY_VERSION VERSION_GREATER_EQUAL "3.12") ${SRC_DIR}/Python/tracemalloc.c ) endif() +if(PY_VERSION VERSION_GREATER_EQUAL "3.13") + # TODO free-threaded sources + Py_GIL_DISABLED + list(APPEND PYTHON_COMMON_SOURCES + ${SRC_DIR}/Python/critical_section.c + ${SRC_DIR}/Python/gc.c + ${SRC_DIR}/Python/lock.c + ) +endif() if(UNIX) list(APPEND PYTHON_COMMON_SOURCES From 51666e3d1675243a6d9edce6276fecf7b9e533a5 Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Thu, 12 Dec 2024 11:29:46 -0500 Subject: [PATCH 14/45] free threading --- CMakeLists.txt | 3 +++ cmake/ConfigureChecks.cmake | 3 +++ cmake/extensions/CMakeLists.txt | 4 ++++ cmake/libpython/CMakeLists.txt | 6 +++++- cmake/python/CMakeLists.txt | 3 +++ 5 files changed, 18 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 65364b1..fa0996d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -162,6 +162,9 @@ if(UNIX) else() set(WITH_STATIC_DEPENDENCIES 0) endif() +if(PY_VERSION VERSION_GREATER_EQUAL "3.13") + option(WITH_FREE_THREADING "Enable experimental free-threaded build and disables the GIL" OFF) +endif() # Detect source directory set(_landmark "pyconfig.h.in") # CMake will look for this file. diff --git a/cmake/ConfigureChecks.cmake b/cmake/ConfigureChecks.cmake index 3d6ab92..7a1540c 100644 --- a/cmake/ConfigureChecks.cmake +++ b/cmake/ConfigureChecks.cmake @@ -207,6 +207,9 @@ endif() if(WITH_PYMALLOC AND PY_VERSION VERSION_LESS "3.8") set(ABIFLAGS "${ABIFLAGS}m") endif() +if(WITH_FREE_THREADING AND PY_VERSION VERSION_GREATER_EQUAL "3.13") + set(ABIFLAGS "${ABIFLAGS}t") +endif() message(STATUS "${_msg} - ${ABIFLAGS}") set(_msg "Checking PLATFORM_TRIPLET") diff --git a/cmake/extensions/CMakeLists.txt b/cmake/extensions/CMakeLists.txt index 298c484..43da670 100644 --- a/cmake/extensions/CMakeLists.txt +++ b/cmake/extensions/CMakeLists.txt @@ -15,6 +15,10 @@ if(Cosmopolitan) set(NOT_COSMOPOLITAN 0) endif() +if(WITH_FREE_THREADING) + add_definitions(-DPy_GIL_DISABLED) +endif() + add_python_extension(array ${WIN32_BUILTIN} SOURCES arraymodule.c) if(PY_VERSION VERSION_LESS "3.13") add_python_extension(audioop ${WIN32_BUILTIN} REQUIRES HAVE_LIBM SOURCES audioop.c LIBRARIES ${M_LIBRARIES}) diff --git a/cmake/libpython/CMakeLists.txt b/cmake/libpython/CMakeLists.txt index a9a75a8..d6359ed 100644 --- a/cmake/libpython/CMakeLists.txt +++ b/cmake/libpython/CMakeLists.txt @@ -2,6 +2,10 @@ add_definitions(-DPy_BUILD_CORE) add_definitions(-DPy_BUILD_CORE_BUILTIN) add_definitions(-DNDEBUG) +if(WITH_FREE_THREADING) + add_definitions(-DPy_GIL_DISABLED) +endif() + set(MODULE_SOURCES # Equivalent to MODULE_OBJS in Makefile.pre ${SRC_DIR}/Modules/gcmodule.c ${SRC_DIR}/Modules/main.c @@ -397,10 +401,10 @@ if(PY_VERSION VERSION_GREATER_EQUAL "3.12") ) endif() if(PY_VERSION VERSION_GREATER_EQUAL "3.13") - # TODO free-threaded sources + Py_GIL_DISABLED list(APPEND PYTHON_COMMON_SOURCES ${SRC_DIR}/Python/critical_section.c ${SRC_DIR}/Python/gc.c + ${SRC_DIR}/Python/gc_free_threading.c ${SRC_DIR}/Python/lock.c ) endif() diff --git a/cmake/python/CMakeLists.txt b/cmake/python/CMakeLists.txt index 903390f..63ae3ac 100644 --- a/cmake/python/CMakeLists.txt +++ b/cmake/python/CMakeLists.txt @@ -12,6 +12,9 @@ set_property( ) target_compile_definitions(python PRIVATE Py_BUILD_CORE) add_definitions(-DPy_BUILD_CORE) +if(WITH_FREE_THREADING) + add_definitions(-DPy_GIL_DISABLED) +endif() # Link against the shared libpython if it was built, otherwise use the static # version. From ace3eaff5e7626ea5e12320c0433980e73784d70 Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Thu, 12 Dec 2024 11:36:30 -0500 Subject: [PATCH 15/45] add missing sources --- cmake/libpython/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmake/libpython/CMakeLists.txt b/cmake/libpython/CMakeLists.txt index d6359ed..af8e562 100644 --- a/cmake/libpython/CMakeLists.txt +++ b/cmake/libpython/CMakeLists.txt @@ -92,6 +92,9 @@ if(PY_VERSION VERSION_GREATER_EQUAL "3.10") ) if(PY_VERSION VERSION_GREATER_EQUAL "3.13") list(APPEND PARSER_COMMON_SOURCES + ${SRC_DIR}/Parser/lexer/buffer.c + ${SRC_DIR}/Parser/lexer/lexer.c + ${SRC_DIR}/Parser/lexer/state.c ${SRC_DIR}/Parser/tokenizer/string_tokenizer.c ${SRC_DIR}/Parser/tokenizer/readline_tokenizer.c ${SRC_DIR}/Parser/tokenizer/utf8_tokenizer.c @@ -406,6 +409,7 @@ if(PY_VERSION VERSION_GREATER_EQUAL "3.13") ${SRC_DIR}/Python/gc.c ${SRC_DIR}/Python/gc_free_threading.c ${SRC_DIR}/Python/lock.c + ${SRC_DIR}/Python/parking_lot.c ) endif() From 95953d0bdde7bba4052c7d79260ffb18e755a3a8 Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Thu, 12 Dec 2024 11:43:29 -0500 Subject: [PATCH 16/45] add missing sources --- cmake/libpython/CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cmake/libpython/CMakeLists.txt b/cmake/libpython/CMakeLists.txt index af8e562..e093af5 100644 --- a/cmake/libpython/CMakeLists.txt +++ b/cmake/libpython/CMakeLists.txt @@ -99,6 +99,7 @@ if(PY_VERSION VERSION_GREATER_EQUAL "3.10") ${SRC_DIR}/Parser/tokenizer/readline_tokenizer.c ${SRC_DIR}/Parser/tokenizer/utf8_tokenizer.c ${SRC_DIR}/Parser/tokenizer/file_tokenizer.c + ${SRC_DIR}/Parser/tokenizer/helpers.c ) else() list(APPEND PARSER_COMMON_SOURCES @@ -406,10 +407,14 @@ endif() if(PY_VERSION VERSION_GREATER_EQUAL "3.13") list(APPEND PYTHON_COMMON_SOURCES ${SRC_DIR}/Python/critical_section.c + ${SRC_DIR}/Python/crossinterp.c ${SRC_DIR}/Python/gc.c ${SRC_DIR}/Python/gc_free_threading.c + ${SRC_DIR}/Python/gc_gil.c + ${SRC_DIR}/Python/instruction_sequence.c ${SRC_DIR}/Python/lock.c ${SRC_DIR}/Python/parking_lot.c + ${SRC_DIR}/Python/qsbr.c ) endif() @@ -973,6 +978,10 @@ if(PY_VERSION VERSION_GREATER_EQUAL "3.12") list(APPEND LIBPYTHON_SOURCES ${SRC_DIR}/Modules/_xxinterpchannelsmodule.c ) + else() + list(APPEND LIBPYTHON_SOURCES + ${SRC_DIR}/Modules/_interpretersmodule.c + ) endif() list(APPEND LIBPYTHON_SOURCES ${SRC_DIR}/Modules/_hacl/Hacl_Hash_MD5.c From e23b76bd1b58685bad1c4c1c629f817def5eb81b Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Thu, 12 Dec 2024 11:46:12 -0500 Subject: [PATCH 17/45] add missing sources --- cmake/libpython/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/libpython/CMakeLists.txt b/cmake/libpython/CMakeLists.txt index e093af5..5da8896 100644 --- a/cmake/libpython/CMakeLists.txt +++ b/cmake/libpython/CMakeLists.txt @@ -413,6 +413,7 @@ if(PY_VERSION VERSION_GREATER_EQUAL "3.13") ${SRC_DIR}/Python/gc_gil.c ${SRC_DIR}/Python/instruction_sequence.c ${SRC_DIR}/Python/lock.c + ${SRC_DIR}/Python/object_stack.c ${SRC_DIR}/Python/parking_lot.c ${SRC_DIR}/Python/qsbr.c ) From 5e8118a9e3ae8dbbfa76889c0406ae2c589328bf Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Thu, 12 Dec 2024 11:59:06 -0500 Subject: [PATCH 18/45] patch deepfreeze.py to create missing parent dirs --- patches/3.13/06-deepfreeze-mkdir.patch | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 patches/3.13/06-deepfreeze-mkdir.patch diff --git a/patches/3.13/06-deepfreeze-mkdir.patch b/patches/3.13/06-deepfreeze-mkdir.patch new file mode 100644 index 0000000..44f30ce --- /dev/null +++ b/patches/3.13/06-deepfreeze-mkdir.patch @@ -0,0 +1,12 @@ +diff --git a/Tools/build/deepfreeze.py b/Tools/build/deepfreeze.py +index 05633e3f77a..a8bdfb37b70 100644 +--- a/Tools/build/deepfreeze.py ++++ b/Tools/build/deepfreeze.py +@@ -518,6 +518,7 @@ def main() -> None: + else: + rules = args.args + ++ os.makedirs(os.path.dirname(output), exist_ok=True) + with open(output, "w", encoding="utf-8") as file: + with report_time("generate"): + generate(rules, file) From 8eb9e5381472df1697df5f33a0e4c9b9c2ad358b Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Thu, 12 Dec 2024 12:18:21 -0500 Subject: [PATCH 19/45] patch getpath to use relative header --- patches/3.13/07-relative-getpath-h.patch | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 patches/3.13/07-relative-getpath-h.patch diff --git a/patches/3.13/07-relative-getpath-h.patch b/patches/3.13/07-relative-getpath-h.patch new file mode 100644 index 0000000..b212409 --- /dev/null +++ b/patches/3.13/07-relative-getpath-h.patch @@ -0,0 +1,13 @@ +diff --git a/Modules/getpath.c b/Modules/getpath.c +index d0128b20fae..13a7df16199 100644 +--- a/Modules/getpath.c ++++ b/Modules/getpath.c +@@ -22,7 +22,7 @@ + #endif + + /* Reference the precompiled getpath.py */ +-#include "Python/frozen_modules/getpath.h" ++#include "../Python/frozen_modules/getpath.h" + + #if (!defined(PREFIX) || !defined(EXEC_PREFIX) \ + || !defined(VERSION) || !defined(VPATH) \ From 4e423c750c45a3b0288485314c8f3713a78cccee Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Thu, 12 Dec 2024 15:02:47 -0500 Subject: [PATCH 20/45] update portable patches --- ...nfig.patch => 02-portable-sysconfig.patch} | 45 ++++++++++++++----- .../portable/02-sysconfig-build-vars.patch | 24 ---------- .../portable/{04-ssl.patch => 03-ssl.patch} | 0 3 files changed, 34 insertions(+), 35 deletions(-) rename patches/3.13/portable/{03-sysconfig-pkgconfig.patch => 02-portable-sysconfig.patch} (60%) delete mode 100644 patches/3.13/portable/02-sysconfig-build-vars.patch rename patches/3.13/portable/{04-ssl.patch => 03-ssl.patch} (100%) diff --git a/patches/3.13/portable/03-sysconfig-pkgconfig.patch b/patches/3.13/portable/02-portable-sysconfig.patch similarity index 60% rename from patches/3.13/portable/03-sysconfig-pkgconfig.patch rename to patches/3.13/portable/02-portable-sysconfig.patch index c4acd6a..d81a6ed 100644 --- a/patches/3.13/portable/03-sysconfig-pkgconfig.patch +++ b/patches/3.13/portable/02-portable-sysconfig.patch @@ -1,11 +1,13 @@ -diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py -index ebe3711827..d2a1716a1c 100644 ---- a/Lib/sysconfig.py -+++ b/Lib/sysconfig.py -@@ -847,5 +847,54 @@ def _main(): - _print_dict('Variables', get_config_vars()) - - +diff --git a/Lib/sysconfig/__init__.py b/Lib/sysconfig/__init__.py +index 80aef344711..628c8b05270 100644 +--- a/Lib/sysconfig/__init__.py ++++ b/Lib/sysconfig/__init__.py +@@ -686,3 +686,52 @@ def expand_makefile_vars(s, vars): + else: + break + return s ++ ++ +# Patch the included pkgconfig files to use the prefix computed during +# runtime. This is a hack for mesonbuild, which looks for Python using +# pkgconfig. Since a portable Python installation can be moved around, @@ -53,7 +55,28 @@ index ebe3711827..d2a1716a1c 100644 + portable_python_fixup_pkgconfig() +except: + pass +\ No newline at end of file +diff --git a/Lib/sysconfig/__main__.py b/Lib/sysconfig/__main__.py +index d7257b9d2d0..9ddfff692bc 100644 +--- a/Lib/sysconfig/__main__.py ++++ b/Lib/sysconfig/__main__.py +@@ -215,6 +215,19 @@ def _generate_posix_vars(): + f.write('build_time_vars = ') + _print_config_dict(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) + -+ - if __name__ == '__main__': - _main() + # 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.13/portable/02-sysconfig-build-vars.patch b/patches/3.13/portable/02-sysconfig-build-vars.patch deleted file mode 100644 index 12101b3..0000000 --- a/patches/3.13/portable/02-sysconfig-build-vars.patch +++ /dev/null @@ -1,24 +0,0 @@ -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.13/portable/04-ssl.patch b/patches/3.13/portable/03-ssl.patch similarity index 100% rename from patches/3.13/portable/04-ssl.patch rename to patches/3.13/portable/03-ssl.patch From 015cd695843959237f1e3a9358b2f423ccb9e1ff Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Thu, 12 Dec 2024 15:09:03 -0500 Subject: [PATCH 21/45] remove dead batteries --- cmake/extensions/CMakeLists.txt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/cmake/extensions/CMakeLists.txt b/cmake/extensions/CMakeLists.txt index 43da670..b2ca18e 100644 --- a/cmake/extensions/CMakeLists.txt +++ b/cmake/extensions/CMakeLists.txt @@ -303,11 +303,13 @@ if(PY_VERSION VERSION_GREATER_EQUAL "3.8") endif() # Windows-only extensions -add_python_extension(_msi - REQUIRES WIN32 - SOURCES ${SRC_DIR}/PC/_msi.c - LIBRARIES cabinet.lib msi.lib rpcrt4.lib -) +if(PY_VERSION VERSION_LESS "3.13") + add_python_extension(_msi + REQUIRES WIN32 + SOURCES ${SRC_DIR}/PC/_msi.c + LIBRARIES cabinet.lib msi.lib rpcrt4.lib + ) +endif() add_python_extension(msvcrt REQUIRES MSVC BUILTIN SOURCES ${SRC_DIR}/PC/msvcrtmodule.c) add_python_extension(nt REQUIRES WIN32 ALWAYS_BUILTIN SOURCES posixmodule.c) add_python_extension(_subprocess REQUIRES WIN32 IS_PY2 BUILTIN SOURCES ${SRC_DIR}/PC/_subprocess.c) From 1bb1e9914de4a16d8b52110a5144c75c5323d5dc Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Thu, 12 Dec 2024 15:50:41 -0500 Subject: [PATCH 22/45] update testinternalcapi --- cmake/extensions/CMakeLists.txt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cmake/extensions/CMakeLists.txt b/cmake/extensions/CMakeLists.txt index b2ca18e..8d80d13 100644 --- a/cmake/extensions/CMakeLists.txt +++ b/cmake/extensions/CMakeLists.txt @@ -227,7 +227,16 @@ endif() # Python 3.8 if(PY_VERSION VERSION_GREATER_EQUAL "3.8") - add_python_extension(_testinternalcapi SOURCES _testinternalcapi.c DEFINITIONS "PY3_DLLNAME=\"python3$<$:_d>\"") + set(_testinternalcapi_SOURCES _testinternalcapi.c) + if(PY_VERSION VERSION_GREATER_EQUAL "3.13") + list(APPEND _testinternalcapi_SOURCES + _testinternalcapi/pytime.c + _testinternalcapi/set.c + _testinternalcapi/test_lock.c + _testinternalcapi/test_critical_sections.c + ) + endif() + add_python_extension(_testinternalcapi SOURCES ${_testinternalcapi_SOURCES} DEFINITIONS "PY3_DLLNAME=\"python3$<$:_d>\"") endif() # Python 3.9 From 728cf08631e59cf18347be68c2fda5772713b8b9 Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Thu, 12 Dec 2024 16:04:31 -0500 Subject: [PATCH 23/45] add missing source --- cmake/libpython/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/libpython/CMakeLists.txt b/cmake/libpython/CMakeLists.txt index 5da8896..6b9b331 100644 --- a/cmake/libpython/CMakeLists.txt +++ b/cmake/libpython/CMakeLists.txt @@ -412,6 +412,7 @@ if(PY_VERSION VERSION_GREATER_EQUAL "3.13") ${SRC_DIR}/Python/gc_free_threading.c ${SRC_DIR}/Python/gc_gil.c ${SRC_DIR}/Python/instruction_sequence.c + ${SRC_DIR}/Python/interpconfig.c ${SRC_DIR}/Python/lock.c ${SRC_DIR}/Python/object_stack.c ${SRC_DIR}/Python/parking_lot.c From 83ffff23e15455148f0d48f4c43350ecba2bee7d Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Thu, 12 Dec 2024 17:26:22 -0500 Subject: [PATCH 24/45] dos2unix --- patches/3.12/06-solaris-fcntlmodule.patch | 40 +++++++++++------------ patches/3.13/05-solaris-fcntlmodule.patch | 40 +++++++++++------------ patches/3.13/06-deepfreeze-mkdir.patch | 24 +++++++------- patches/3.13/07-relative-getpath-h.patch | 26 +++++++-------- 4 files changed, 65 insertions(+), 65 deletions(-) diff --git a/patches/3.12/06-solaris-fcntlmodule.patch b/patches/3.12/06-solaris-fcntlmodule.patch index f0c2cff..269a636 100644 --- a/patches/3.12/06-solaris-fcntlmodule.patch +++ b/patches/3.12/06-solaris-fcntlmodule.patch @@ -1,20 +1,20 @@ -diff --git a/Modules/fcntlmodule.c b/Modules/fcntlmodule.c -index 2bca40213c6..59dab31bc40 100644 ---- a/Modules/fcntlmodule.c -+++ b/Modules/fcntlmodule.c -@@ -628,6 +628,15 @@ all_ins(PyObject* m) - #endif - - #ifdef HAVE_STROPTS_H -+ -+#if defined(sun) || defined(__sun) -+ #ifndef STR -+ /* for some reason, the preprocessor does not resolve this symbol */ -+ /* from /usr/include/sys/stropts.h on Solaris 11 */ -+ #define STR ('S'<<8) -+ #endif -+#endif -+ - /* Unix 98 guarantees that these are in stropts.h. */ - if (PyModule_AddIntMacro(m, I_PUSH)) return -1; - if (PyModule_AddIntMacro(m, I_POP)) return -1; +diff --git a/Modules/fcntlmodule.c b/Modules/fcntlmodule.c +index 2bca40213c6..59dab31bc40 100644 +--- a/Modules/fcntlmodule.c ++++ b/Modules/fcntlmodule.c +@@ -628,6 +628,15 @@ all_ins(PyObject* m) + #endif + + #ifdef HAVE_STROPTS_H ++ ++#if defined(sun) || defined(__sun) ++ #ifndef STR ++ /* for some reason, the preprocessor does not resolve this symbol */ ++ /* from /usr/include/sys/stropts.h on Solaris 11 */ ++ #define STR ('S'<<8) ++ #endif ++#endif ++ + /* Unix 98 guarantees that these are in stropts.h. */ + if (PyModule_AddIntMacro(m, I_PUSH)) return -1; + if (PyModule_AddIntMacro(m, I_POP)) return -1; diff --git a/patches/3.13/05-solaris-fcntlmodule.patch b/patches/3.13/05-solaris-fcntlmodule.patch index f0c2cff..269a636 100644 --- a/patches/3.13/05-solaris-fcntlmodule.patch +++ b/patches/3.13/05-solaris-fcntlmodule.patch @@ -1,20 +1,20 @@ -diff --git a/Modules/fcntlmodule.c b/Modules/fcntlmodule.c -index 2bca40213c6..59dab31bc40 100644 ---- a/Modules/fcntlmodule.c -+++ b/Modules/fcntlmodule.c -@@ -628,6 +628,15 @@ all_ins(PyObject* m) - #endif - - #ifdef HAVE_STROPTS_H -+ -+#if defined(sun) || defined(__sun) -+ #ifndef STR -+ /* for some reason, the preprocessor does not resolve this symbol */ -+ /* from /usr/include/sys/stropts.h on Solaris 11 */ -+ #define STR ('S'<<8) -+ #endif -+#endif -+ - /* Unix 98 guarantees that these are in stropts.h. */ - if (PyModule_AddIntMacro(m, I_PUSH)) return -1; - if (PyModule_AddIntMacro(m, I_POP)) return -1; +diff --git a/Modules/fcntlmodule.c b/Modules/fcntlmodule.c +index 2bca40213c6..59dab31bc40 100644 +--- a/Modules/fcntlmodule.c ++++ b/Modules/fcntlmodule.c +@@ -628,6 +628,15 @@ all_ins(PyObject* m) + #endif + + #ifdef HAVE_STROPTS_H ++ ++#if defined(sun) || defined(__sun) ++ #ifndef STR ++ /* for some reason, the preprocessor does not resolve this symbol */ ++ /* from /usr/include/sys/stropts.h on Solaris 11 */ ++ #define STR ('S'<<8) ++ #endif ++#endif ++ + /* Unix 98 guarantees that these are in stropts.h. */ + if (PyModule_AddIntMacro(m, I_PUSH)) return -1; + if (PyModule_AddIntMacro(m, I_POP)) return -1; diff --git a/patches/3.13/06-deepfreeze-mkdir.patch b/patches/3.13/06-deepfreeze-mkdir.patch index 44f30ce..5dd6a5d 100644 --- a/patches/3.13/06-deepfreeze-mkdir.patch +++ b/patches/3.13/06-deepfreeze-mkdir.patch @@ -1,12 +1,12 @@ -diff --git a/Tools/build/deepfreeze.py b/Tools/build/deepfreeze.py -index 05633e3f77a..a8bdfb37b70 100644 ---- a/Tools/build/deepfreeze.py -+++ b/Tools/build/deepfreeze.py -@@ -518,6 +518,7 @@ def main() -> None: - else: - rules = args.args - -+ os.makedirs(os.path.dirname(output), exist_ok=True) - with open(output, "w", encoding="utf-8") as file: - with report_time("generate"): - generate(rules, file) +diff --git a/Tools/build/deepfreeze.py b/Tools/build/deepfreeze.py +index 05633e3f77a..a8bdfb37b70 100644 +--- a/Tools/build/deepfreeze.py ++++ b/Tools/build/deepfreeze.py +@@ -518,6 +518,7 @@ def main() -> None: + else: + rules = args.args + ++ os.makedirs(os.path.dirname(output), exist_ok=True) + with open(output, "w", encoding="utf-8") as file: + with report_time("generate"): + generate(rules, file) diff --git a/patches/3.13/07-relative-getpath-h.patch b/patches/3.13/07-relative-getpath-h.patch index b212409..69fe3eb 100644 --- a/patches/3.13/07-relative-getpath-h.patch +++ b/patches/3.13/07-relative-getpath-h.patch @@ -1,13 +1,13 @@ -diff --git a/Modules/getpath.c b/Modules/getpath.c -index d0128b20fae..13a7df16199 100644 ---- a/Modules/getpath.c -+++ b/Modules/getpath.c -@@ -22,7 +22,7 @@ - #endif - - /* Reference the precompiled getpath.py */ --#include "Python/frozen_modules/getpath.h" -+#include "../Python/frozen_modules/getpath.h" - - #if (!defined(PREFIX) || !defined(EXEC_PREFIX) \ - || !defined(VERSION) || !defined(VPATH) \ +diff --git a/Modules/getpath.c b/Modules/getpath.c +index d0128b20fae..13a7df16199 100644 +--- a/Modules/getpath.c ++++ b/Modules/getpath.c +@@ -22,7 +22,7 @@ + #endif + + /* Reference the precompiled getpath.py */ +-#include "Python/frozen_modules/getpath.h" ++#include "../Python/frozen_modules/getpath.h" + + #if (!defined(PREFIX) || !defined(EXEC_PREFIX) \ + || !defined(VERSION) || !defined(VPATH) \ From e6d2958749928b19242024721dcc781305de45ec Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Thu, 12 Dec 2024 19:09:54 -0500 Subject: [PATCH 25/45] fix gettimeofday --- patches/3.13/08-testcapimodule-gettimeofday.patch | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 patches/3.13/08-testcapimodule-gettimeofday.patch diff --git a/patches/3.13/08-testcapimodule-gettimeofday.patch b/patches/3.13/08-testcapimodule-gettimeofday.patch new file mode 100644 index 0000000..026d023 --- /dev/null +++ b/patches/3.13/08-testcapimodule-gettimeofday.patch @@ -0,0 +1,15 @@ +diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c +index 01b6bd89d13..a5a97a1d618 100644 +--- a/Modules/_testcapimodule.c ++++ b/Modules/_testcapimodule.c +@@ -23,6 +23,10 @@ + # include // W_STOPCODE + #endif + ++#ifdef HAVE_SYS_TIME_H ++# include ++#endif ++ + #ifdef bool + # error "The public headers should not include , see gh-48924" + #endif From 4f200413736ffaa403b5c0b89723b84413014a5c Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Thu, 12 Dec 2024 20:48:59 -0500 Subject: [PATCH 26/45] use different freeze script --- cmake/libpython/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmake/libpython/CMakeLists.txt b/cmake/libpython/CMakeLists.txt index 6b9b331..cb71670 100644 --- a/cmake/libpython/CMakeLists.txt +++ b/cmake/libpython/CMakeLists.txt @@ -844,7 +844,9 @@ else() ${SRC_DIR}/Modules/getpath.py ) - if(PY_VERSION VERSION_GREATER_EQUAL "3.12") + if(PY_VERSION VERSION_GREATER_EQUAL "3.13") + set(DEEPFREEZE_PY ${SRC_DIR}/Programs/_freeze_module.py) + elif(PY_VERSION VERSION_EQUAL "3.12") set(DEEPFREEZE_PY ${SRC_DIR}/Tools/build/deepfreeze.py) else() set(DEEPFREEZE_PY ${SRC_DIR}/Tools/scripts/deepfreeze.py) From 9c709a9c5a78306f075a3289d0b5624f461972fd Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Thu, 12 Dec 2024 20:50:40 -0500 Subject: [PATCH 27/45] syntax --- cmake/libpython/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/libpython/CMakeLists.txt b/cmake/libpython/CMakeLists.txt index cb71670..c51e6d2 100644 --- a/cmake/libpython/CMakeLists.txt +++ b/cmake/libpython/CMakeLists.txt @@ -846,7 +846,7 @@ else() if(PY_VERSION VERSION_GREATER_EQUAL "3.13") set(DEEPFREEZE_PY ${SRC_DIR}/Programs/_freeze_module.py) - elif(PY_VERSION VERSION_EQUAL "3.12") + elseif(PY_VERSION VERSION_EQUAL "3.12") set(DEEPFREEZE_PY ${SRC_DIR}/Tools/build/deepfreeze.py) else() set(DEEPFREEZE_PY ${SRC_DIR}/Tools/scripts/deepfreeze.py) From b68efb5260a2e80d983d75313e1d03d0f91dd072 Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Thu, 12 Dec 2024 20:59:20 -0500 Subject: [PATCH 28/45] Revert "syntax" This reverts commit 9c709a9c5a78306f075a3289d0b5624f461972fd. --- cmake/libpython/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/libpython/CMakeLists.txt b/cmake/libpython/CMakeLists.txt index c51e6d2..cb71670 100644 --- a/cmake/libpython/CMakeLists.txt +++ b/cmake/libpython/CMakeLists.txt @@ -846,7 +846,7 @@ else() if(PY_VERSION VERSION_GREATER_EQUAL "3.13") set(DEEPFREEZE_PY ${SRC_DIR}/Programs/_freeze_module.py) - elseif(PY_VERSION VERSION_EQUAL "3.12") + elif(PY_VERSION VERSION_EQUAL "3.12") set(DEEPFREEZE_PY ${SRC_DIR}/Tools/build/deepfreeze.py) else() set(DEEPFREEZE_PY ${SRC_DIR}/Tools/scripts/deepfreeze.py) From 9c8b69866e87ab0e3b856c066b1e5586023664ba Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Thu, 12 Dec 2024 20:59:32 -0500 Subject: [PATCH 29/45] Revert "use different freeze script" This reverts commit 4f200413736ffaa403b5c0b89723b84413014a5c. --- cmake/libpython/CMakeLists.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/cmake/libpython/CMakeLists.txt b/cmake/libpython/CMakeLists.txt index cb71670..6b9b331 100644 --- a/cmake/libpython/CMakeLists.txt +++ b/cmake/libpython/CMakeLists.txt @@ -844,9 +844,7 @@ else() ${SRC_DIR}/Modules/getpath.py ) - if(PY_VERSION VERSION_GREATER_EQUAL "3.13") - set(DEEPFREEZE_PY ${SRC_DIR}/Programs/_freeze_module.py) - elif(PY_VERSION VERSION_EQUAL "3.12") + if(PY_VERSION VERSION_GREATER_EQUAL "3.12") set(DEEPFREEZE_PY ${SRC_DIR}/Tools/build/deepfreeze.py) else() set(DEEPFREEZE_PY ${SRC_DIR}/Tools/scripts/deepfreeze.py) From 0fe121909849f77be22eb4886c1dc1cb47736de6 Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Thu, 12 Dec 2024 20:59:39 -0500 Subject: [PATCH 30/45] dos2unix --- .../3.13/08-testcapimodule-gettimeofday.patch | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/patches/3.13/08-testcapimodule-gettimeofday.patch b/patches/3.13/08-testcapimodule-gettimeofday.patch index 026d023..a6bdf71 100644 --- a/patches/3.13/08-testcapimodule-gettimeofday.patch +++ b/patches/3.13/08-testcapimodule-gettimeofday.patch @@ -1,15 +1,15 @@ -diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c -index 01b6bd89d13..a5a97a1d618 100644 ---- a/Modules/_testcapimodule.c -+++ b/Modules/_testcapimodule.c -@@ -23,6 +23,10 @@ - # include // W_STOPCODE - #endif - -+#ifdef HAVE_SYS_TIME_H -+# include -+#endif -+ - #ifdef bool - # error "The public headers should not include , see gh-48924" - #endif +diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c +index 01b6bd89d13..a5a97a1d618 100644 +--- a/Modules/_testcapimodule.c ++++ b/Modules/_testcapimodule.c +@@ -23,6 +23,10 @@ + # include // W_STOPCODE + #endif + ++#ifdef HAVE_SYS_TIME_H ++# include ++#endif ++ + #ifdef bool + # error "The public headers should not include , see gh-48924" + #endif From 28bbbeed873051870ba17aebb6bdbdc6873fa4e8 Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Thu, 12 Dec 2024 21:16:31 -0500 Subject: [PATCH 31/45] deepfreeze.c is no longer needed? + reindent --- cmake/libpython/CMakeLists.txt | 382 +++++++++++++++++---------------- 1 file changed, 192 insertions(+), 190 deletions(-) diff --git a/cmake/libpython/CMakeLists.txt b/cmake/libpython/CMakeLists.txt index 6b9b331..f8ff17a 100644 --- a/cmake/libpython/CMakeLists.txt +++ b/cmake/libpython/CMakeLists.txt @@ -582,10 +582,10 @@ 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 - ) +if(PY_VERSION VERSION_GREATER_EQUAL "3.11" AND PY_VERSION VERSION_LESS "3.13") + set(LIBPYTHON_DEEPFREEZE_SOURCES + ${SRC_DIR}/Python/deepfreeze/deepfreeze.c + ) endif() if(IS_PY3) @@ -669,218 +669,220 @@ if(PY_VERSION VERSION_LESS "3.11") 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/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 - ${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_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/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 + ${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 ) - if(PY_VERSION VERSION_GREATER_EQUAL "3.12") - set(DEEPFREEZE_PY ${SRC_DIR}/Tools/build/deepfreeze.py) - else() - set(DEEPFREEZE_PY ${SRC_DIR}/Tools/scripts/deepfreeze.py) - endif() - add_custom_command( - OUTPUT ${LIBPYTHON_DEEPFREEZE_SOURCES} - COMMAND - ${Python3_EXECUTABLE} ${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 - ${DEEPFREEZE_PY} - ${LIBPYTHON_FROZEN_SOURCES} - ) + if(PY_VERSION VERSION_LESS "3.13") + if(PY_VERSION VERSION_EQUAL "3.12") + set(DEEPFREEZE_PY ${SRC_DIR}/Tools/build/deepfreeze.py) + else() + set(DEEPFREEZE_PY ${SRC_DIR}/Tools/scripts/deepfreeze.py) + endif() + add_custom_command( + OUTPUT ${LIBPYTHON_DEEPFREEZE_SOURCES} + COMMAND + ${Python3_EXECUTABLE} ${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 + ${DEEPFREEZE_PY} + ${LIBPYTHON_FROZEN_SOURCES} + ) + endif() endif() # This is a convenience target allowing to regenerate From 845b26c43fcb68ace07f2319d88716b165d77eb5 Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Thu, 12 Dec 2024 21:31:48 -0500 Subject: [PATCH 32/45] remove unused patch --- patches/3.13/06-deepfreeze-mkdir.patch | 12 ------------ ...e-getpath-h.patch => 06-relative-getpath-h.patch} | 0 ...ay.patch => 07-testcapimodule-gettimeofday.patch} | 0 3 files changed, 12 deletions(-) delete mode 100644 patches/3.13/06-deepfreeze-mkdir.patch rename patches/3.13/{07-relative-getpath-h.patch => 06-relative-getpath-h.patch} (100%) rename patches/3.13/{08-testcapimodule-gettimeofday.patch => 07-testcapimodule-gettimeofday.patch} (100%) diff --git a/patches/3.13/06-deepfreeze-mkdir.patch b/patches/3.13/06-deepfreeze-mkdir.patch deleted file mode 100644 index 5dd6a5d..0000000 --- a/patches/3.13/06-deepfreeze-mkdir.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/Tools/build/deepfreeze.py b/Tools/build/deepfreeze.py -index 05633e3f77a..a8bdfb37b70 100644 ---- a/Tools/build/deepfreeze.py -+++ b/Tools/build/deepfreeze.py -@@ -518,6 +518,7 @@ def main() -> None: - else: - rules = args.args - -+ os.makedirs(os.path.dirname(output), exist_ok=True) - with open(output, "w", encoding="utf-8") as file: - with report_time("generate"): - generate(rules, file) diff --git a/patches/3.13/07-relative-getpath-h.patch b/patches/3.13/06-relative-getpath-h.patch similarity index 100% rename from patches/3.13/07-relative-getpath-h.patch rename to patches/3.13/06-relative-getpath-h.patch diff --git a/patches/3.13/08-testcapimodule-gettimeofday.patch b/patches/3.13/07-testcapimodule-gettimeofday.patch similarity index 100% rename from patches/3.13/08-testcapimodule-gettimeofday.patch rename to patches/3.13/07-testcapimodule-gettimeofday.patch From 128e75d4f2af6dc3fbc66f0a6c1c9ecd0ae640f5 Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Fri, 13 Dec 2024 14:15:10 -0500 Subject: [PATCH 33/45] copy over windows pyconfig.h.in --- CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index fa0996d..4337edb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -591,6 +591,14 @@ if(UNIX) configure_file(cmake/config-unix/pyconfig.h.in ${PYCONFIG_BUILD_DIR}/pyconfig.h) elseif(WIN32) + if(PY_VERSION VERSION_GREATER_EQUAL "3.13") + file(READ ${SRC_DIR}/PC/pyconfig.h.in PYCONFIG_H_CONTENTS) + if(WITH_FREE_THREADING) + string(REPLACE "/* #define Py_GIL_DISABLED 1 */" "#define Py_GIL_DISABLED 1" PYCONFIG_H_CONTENTS "${PYCONFIG_H_CONTENTS}") + endif() + file(WRITE ${SRC_DIR}/PC/pyconfig.h "${PYCONFIG_H_CONTENTS}") + endif() + set(PYCONFIG_BUILD_DIR ${SRC_DIR}/PC) # In a windows build tree, 'pyconfig.h' is NOT required to # live along side the python executable. # See function '_init_posix()' and '_init_non_posix()' From e95844fe4faff01d6510ac240c3d5eac1e373810 Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Fri, 13 Dec 2024 14:29:19 -0500 Subject: [PATCH 34/45] include mimalloc --- cmake/libpython/CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmake/libpython/CMakeLists.txt b/cmake/libpython/CMakeLists.txt index f8ff17a..b4a523e 100644 --- a/cmake/libpython/CMakeLists.txt +++ b/cmake/libpython/CMakeLists.txt @@ -244,6 +244,13 @@ if(PY_VERSION VERSION_GREATER_EQUAL "3.10") ${SRC_DIR}/Objects/unionobject.c ) endif() +if(PY_VERSION VERSION_GREATER_EQUAL "3.13") + if(WIN32) + # mimalloc is enabled for Windows + # TODO: enable this for other platforms via switches + include_directories(${SRC_DIR}/Include/internal/mimalloc) + endif() +endif() if(CMAKE_C_COMPILER_ID MATCHES GNU) foreach(filename class complex float int method string type unicode weakref) From 158aa4604b1e9c6ced8a394dc01b6055167240ca Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Fri, 13 Dec 2024 16:27:15 -0500 Subject: [PATCH 35/45] remove freebsd errno patch --- ...random.patch => 02-cosmo-sys-random.patch} | 0 patches/3.13/02-freebsd-errno.patch | 20 ------------------- ...tch => 03-getpath_noop-missing-stub.patch} | 0 ...ule.patch => 04-solaris-fcntlmodule.patch} | 0 ...th-h.patch => 05-relative-getpath-h.patch} | 0 ...h => 06-testcapimodule-gettimeofday.patch} | 0 6 files changed, 20 deletions(-) rename patches/3.13/{03-cosmo-sys-random.patch => 02-cosmo-sys-random.patch} (100%) delete mode 100644 patches/3.13/02-freebsd-errno.patch rename patches/3.13/{04-getpath_noop-missing-stub.patch => 03-getpath_noop-missing-stub.patch} (100%) rename patches/3.13/{05-solaris-fcntlmodule.patch => 04-solaris-fcntlmodule.patch} (100%) rename patches/3.13/{06-relative-getpath-h.patch => 05-relative-getpath-h.patch} (100%) rename patches/3.13/{07-testcapimodule-gettimeofday.patch => 06-testcapimodule-gettimeofday.patch} (100%) diff --git a/patches/3.13/03-cosmo-sys-random.patch b/patches/3.13/02-cosmo-sys-random.patch similarity index 100% rename from patches/3.13/03-cosmo-sys-random.patch rename to patches/3.13/02-cosmo-sys-random.patch diff --git a/patches/3.13/02-freebsd-errno.patch b/patches/3.13/02-freebsd-errno.patch deleted file mode 100644 index 040cd69..0000000 --- a/patches/3.13/02-freebsd-errno.patch +++ /dev/null @@ -1,20 +0,0 @@ -diff --git a/Include/Python.h b/Include/Python.h -index fb2d32d7110..4b8bf901bdf 100644 ---- a/Include/Python.h -+++ b/Include/Python.h -@@ -33,7 +33,15 @@ - // The and headers are not included by limited C API - // version 3.13 and newer. - #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 -+# if defined(__FreeBSD__) && defined(_POSIX_SOURCE) -+# define _WANT_POSIX_SOURCE -+# undef _POSIX_SOURCE -+# endif - # include // errno -+# if defined(_WANT_POSIX_SOURCE) -+# define _POSIX_SOURCE -+# undef _WANT_POSIX_SOURCE -+# endif - # include // FILE* - # include // getenv() - # include // memcpy() diff --git a/patches/3.13/04-getpath_noop-missing-stub.patch b/patches/3.13/03-getpath_noop-missing-stub.patch similarity index 100% rename from patches/3.13/04-getpath_noop-missing-stub.patch rename to patches/3.13/03-getpath_noop-missing-stub.patch diff --git a/patches/3.13/05-solaris-fcntlmodule.patch b/patches/3.13/04-solaris-fcntlmodule.patch similarity index 100% rename from patches/3.13/05-solaris-fcntlmodule.patch rename to patches/3.13/04-solaris-fcntlmodule.patch diff --git a/patches/3.13/06-relative-getpath-h.patch b/patches/3.13/05-relative-getpath-h.patch similarity index 100% rename from patches/3.13/06-relative-getpath-h.patch rename to patches/3.13/05-relative-getpath-h.patch diff --git a/patches/3.13/07-testcapimodule-gettimeofday.patch b/patches/3.13/06-testcapimodule-gettimeofday.patch similarity index 100% rename from patches/3.13/07-testcapimodule-gettimeofday.patch rename to patches/3.13/06-testcapimodule-gettimeofday.patch From 65f4ceb2d8da3f73c8da5542722142621b33fe9d Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Fri, 13 Dec 2024 18:41:22 -0500 Subject: [PATCH 36/45] Revert "remove freebsd errno patch" This reverts commit 158aa4604b1e9c6ced8a394dc01b6055167240ca. --- patches/3.13/02-freebsd-errno.patch | 20 +++++++++++++++++++ ...random.patch => 03-cosmo-sys-random.patch} | 0 ...tch => 04-getpath_noop-missing-stub.patch} | 0 ...ule.patch => 05-solaris-fcntlmodule.patch} | 0 ...th-h.patch => 06-relative-getpath-h.patch} | 0 ...h => 07-testcapimodule-gettimeofday.patch} | 0 6 files changed, 20 insertions(+) create mode 100644 patches/3.13/02-freebsd-errno.patch rename patches/3.13/{02-cosmo-sys-random.patch => 03-cosmo-sys-random.patch} (100%) rename patches/3.13/{03-getpath_noop-missing-stub.patch => 04-getpath_noop-missing-stub.patch} (100%) rename patches/3.13/{04-solaris-fcntlmodule.patch => 05-solaris-fcntlmodule.patch} (100%) rename patches/3.13/{05-relative-getpath-h.patch => 06-relative-getpath-h.patch} (100%) rename patches/3.13/{06-testcapimodule-gettimeofday.patch => 07-testcapimodule-gettimeofday.patch} (100%) diff --git a/patches/3.13/02-freebsd-errno.patch b/patches/3.13/02-freebsd-errno.patch new file mode 100644 index 0000000..040cd69 --- /dev/null +++ b/patches/3.13/02-freebsd-errno.patch @@ -0,0 +1,20 @@ +diff --git a/Include/Python.h b/Include/Python.h +index fb2d32d7110..4b8bf901bdf 100644 +--- a/Include/Python.h ++++ b/Include/Python.h +@@ -33,7 +33,15 @@ + // The and headers are not included by limited C API + // version 3.13 and newer. + #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 ++# if defined(__FreeBSD__) && defined(_POSIX_SOURCE) ++# define _WANT_POSIX_SOURCE ++# undef _POSIX_SOURCE ++# endif + # include // errno ++# if defined(_WANT_POSIX_SOURCE) ++# define _POSIX_SOURCE ++# undef _WANT_POSIX_SOURCE ++# endif + # include // FILE* + # include // getenv() + # include // memcpy() diff --git a/patches/3.13/02-cosmo-sys-random.patch b/patches/3.13/03-cosmo-sys-random.patch similarity index 100% rename from patches/3.13/02-cosmo-sys-random.patch rename to patches/3.13/03-cosmo-sys-random.patch diff --git a/patches/3.13/03-getpath_noop-missing-stub.patch b/patches/3.13/04-getpath_noop-missing-stub.patch similarity index 100% rename from patches/3.13/03-getpath_noop-missing-stub.patch rename to patches/3.13/04-getpath_noop-missing-stub.patch diff --git a/patches/3.13/04-solaris-fcntlmodule.patch b/patches/3.13/05-solaris-fcntlmodule.patch similarity index 100% rename from patches/3.13/04-solaris-fcntlmodule.patch rename to patches/3.13/05-solaris-fcntlmodule.patch diff --git a/patches/3.13/05-relative-getpath-h.patch b/patches/3.13/06-relative-getpath-h.patch similarity index 100% rename from patches/3.13/05-relative-getpath-h.patch rename to patches/3.13/06-relative-getpath-h.patch diff --git a/patches/3.13/06-testcapimodule-gettimeofday.patch b/patches/3.13/07-testcapimodule-gettimeofday.patch similarity index 100% rename from patches/3.13/06-testcapimodule-gettimeofday.patch rename to patches/3.13/07-testcapimodule-gettimeofday.patch From c67404ce7cb590e17b72c3984de59f82dbbd3670 Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Fri, 13 Dec 2024 18:46:25 -0500 Subject: [PATCH 37/45] update errno patch --- patches/3.13/02-freebsd-errno.patch | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/patches/3.13/02-freebsd-errno.patch b/patches/3.13/02-freebsd-errno.patch index 040cd69..150e1d5 100644 --- a/patches/3.13/02-freebsd-errno.patch +++ b/patches/3.13/02-freebsd-errno.patch @@ -18,3 +18,18 @@ index fb2d32d7110..4b8bf901bdf 100644 # include // FILE* # include // getenv() # include // memcpy() +diff --git a/Modules/errnomodule.c b/Modules/errnomodule.c +index 3f96f2f846d..e796caad205 100644 +--- a/Modules/errnomodule.c ++++ b/Modules/errnomodule.c +@@ -6,6 +6,10 @@ + # define Py_LIMITED_API 0x030d0000 + #endif + ++#if defined(__FreeBSD__) ++# include ++#endif ++ + #include "Python.h" + #include // EPIPE + From 711d2b5d4e2ffdab6d1baa45daf5c91518eaabda Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Sat, 14 Dec 2024 07:58:24 -0500 Subject: [PATCH 38/45] Revert "update errno patch" This reverts commit c67404ce7cb590e17b72c3984de59f82dbbd3670. --- patches/3.13/02-freebsd-errno.patch | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/patches/3.13/02-freebsd-errno.patch b/patches/3.13/02-freebsd-errno.patch index 150e1d5..040cd69 100644 --- a/patches/3.13/02-freebsd-errno.patch +++ b/patches/3.13/02-freebsd-errno.patch @@ -18,18 +18,3 @@ index fb2d32d7110..4b8bf901bdf 100644 # include // FILE* # include // getenv() # include // memcpy() -diff --git a/Modules/errnomodule.c b/Modules/errnomodule.c -index 3f96f2f846d..e796caad205 100644 ---- a/Modules/errnomodule.c -+++ b/Modules/errnomodule.c -@@ -6,6 +6,10 @@ - # define Py_LIMITED_API 0x030d0000 - #endif - -+#if defined(__FreeBSD__) -+# include -+#endif -+ - #include "Python.h" - #include // EPIPE - From f0a0935c4b509a93f0638c8e6962e8c8d7778503 Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Sat, 14 Dec 2024 07:58:26 -0500 Subject: [PATCH 39/45] Revert "Revert "remove freebsd errno patch"" This reverts commit 65f4ceb2d8da3f73c8da5542722142621b33fe9d. --- ...random.patch => 02-cosmo-sys-random.patch} | 0 patches/3.13/02-freebsd-errno.patch | 20 ------------------- ...tch => 03-getpath_noop-missing-stub.patch} | 0 ...ule.patch => 04-solaris-fcntlmodule.patch} | 0 ...th-h.patch => 05-relative-getpath-h.patch} | 0 ...h => 06-testcapimodule-gettimeofday.patch} | 0 6 files changed, 20 deletions(-) rename patches/3.13/{03-cosmo-sys-random.patch => 02-cosmo-sys-random.patch} (100%) delete mode 100644 patches/3.13/02-freebsd-errno.patch rename patches/3.13/{04-getpath_noop-missing-stub.patch => 03-getpath_noop-missing-stub.patch} (100%) rename patches/3.13/{05-solaris-fcntlmodule.patch => 04-solaris-fcntlmodule.patch} (100%) rename patches/3.13/{06-relative-getpath-h.patch => 05-relative-getpath-h.patch} (100%) rename patches/3.13/{07-testcapimodule-gettimeofday.patch => 06-testcapimodule-gettimeofday.patch} (100%) diff --git a/patches/3.13/03-cosmo-sys-random.patch b/patches/3.13/02-cosmo-sys-random.patch similarity index 100% rename from patches/3.13/03-cosmo-sys-random.patch rename to patches/3.13/02-cosmo-sys-random.patch diff --git a/patches/3.13/02-freebsd-errno.patch b/patches/3.13/02-freebsd-errno.patch deleted file mode 100644 index 040cd69..0000000 --- a/patches/3.13/02-freebsd-errno.patch +++ /dev/null @@ -1,20 +0,0 @@ -diff --git a/Include/Python.h b/Include/Python.h -index fb2d32d7110..4b8bf901bdf 100644 ---- a/Include/Python.h -+++ b/Include/Python.h -@@ -33,7 +33,15 @@ - // The and headers are not included by limited C API - // version 3.13 and newer. - #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 -+# if defined(__FreeBSD__) && defined(_POSIX_SOURCE) -+# define _WANT_POSIX_SOURCE -+# undef _POSIX_SOURCE -+# endif - # include // errno -+# if defined(_WANT_POSIX_SOURCE) -+# define _POSIX_SOURCE -+# undef _WANT_POSIX_SOURCE -+# endif - # include // FILE* - # include // getenv() - # include // memcpy() diff --git a/patches/3.13/04-getpath_noop-missing-stub.patch b/patches/3.13/03-getpath_noop-missing-stub.patch similarity index 100% rename from patches/3.13/04-getpath_noop-missing-stub.patch rename to patches/3.13/03-getpath_noop-missing-stub.patch diff --git a/patches/3.13/05-solaris-fcntlmodule.patch b/patches/3.13/04-solaris-fcntlmodule.patch similarity index 100% rename from patches/3.13/05-solaris-fcntlmodule.patch rename to patches/3.13/04-solaris-fcntlmodule.patch diff --git a/patches/3.13/06-relative-getpath-h.patch b/patches/3.13/05-relative-getpath-h.patch similarity index 100% rename from patches/3.13/06-relative-getpath-h.patch rename to patches/3.13/05-relative-getpath-h.patch diff --git a/patches/3.13/07-testcapimodule-gettimeofday.patch b/patches/3.13/06-testcapimodule-gettimeofday.patch similarity index 100% rename from patches/3.13/07-testcapimodule-gettimeofday.patch rename to patches/3.13/06-testcapimodule-gettimeofday.patch From 79134fe078b85f789b867e688a0ba8fefa637e15 Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Sat, 14 Dec 2024 08:22:46 -0500 Subject: [PATCH 40/45] update freebsd errno patch --- patches/3.10/02-freebsd-errno.patch | 30 ++++++++----------- patches/3.11/02-freebsd-errno.patch | 22 ++++++-------- patches/3.12/02-freebsd-errno.patch | 22 ++++++-------- patches/3.13/02-freebsd-errno.patch | 16 ++++++++++ ...random.patch => 03-cosmo-sys-random.patch} | 0 ...tch => 04-getpath_noop-missing-stub.patch} | 0 ...ule.patch => 05-solaris-fcntlmodule.patch} | 0 ...th-h.patch => 06-relative-getpath-h.patch} | 0 ...h => 07-testcapimodule-gettimeofday.patch} | 0 patches/3.9/02-freebsd-errno.patch | 30 ++++++++----------- 10 files changed, 60 insertions(+), 60 deletions(-) create mode 100644 patches/3.13/02-freebsd-errno.patch rename patches/3.13/{02-cosmo-sys-random.patch => 03-cosmo-sys-random.patch} (100%) rename patches/3.13/{03-getpath_noop-missing-stub.patch => 04-getpath_noop-missing-stub.patch} (100%) rename patches/3.13/{04-solaris-fcntlmodule.patch => 05-solaris-fcntlmodule.patch} (100%) rename patches/3.13/{05-relative-getpath-h.patch => 06-relative-getpath-h.patch} (100%) rename patches/3.13/{06-testcapimodule-gettimeofday.patch => 07-testcapimodule-gettimeofday.patch} (100%) diff --git a/patches/3.10/02-freebsd-errno.patch b/patches/3.10/02-freebsd-errno.patch index d9a21f0..eee81ce 100644 --- a/patches/3.10/02-freebsd-errno.patch +++ b/patches/3.10/02-freebsd-errno.patch @@ -1,20 +1,16 @@ diff --git a/Include/Python.h b/Include/Python.h -index 7f7ed5981c..9499df113f 100644 +index fb2d32d7110..5b684c7079d 100644 --- a/Include/Python.h +++ b/Include/Python.h -@@ -29,7 +29,15 @@ - - #include - #ifdef HAVE_ERRNO_H -+# if defined(__FreeBSD__) && defined(_POSIX_SOURCE) -+# define _WANT_POSIX_SOURCE -+# undef _POSIX_SOURCE -+# endif - #include -+# if defined(_WANT_POSIX_SOURCE) -+# undef _WANT_POSIX_SOURCE -+# define _POSIX_SOURCE -+# endif - #endif - #include - #ifndef MS_WINDOWS +@@ -34,6 +34,11 @@ + // version 3.13 and newer. + #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 + # include // errno ++# if defined(__FreeBSD__) ++# ifndef EWOULDBLOCK ++# define EWOULDBLOCK EAGAIN /* Operation would block */ ++# endif ++# endif + # include // FILE* + # include // getenv() + # include // memcpy() diff --git a/patches/3.11/02-freebsd-errno.patch b/patches/3.11/02-freebsd-errno.patch index 6c828db..eee81ce 100644 --- a/patches/3.11/02-freebsd-errno.patch +++ b/patches/3.11/02-freebsd-errno.patch @@ -1,20 +1,16 @@ diff --git a/Include/Python.h b/Include/Python.h -index 52a7aac6ba..c09deb9223 100644 +index fb2d32d7110..5b684c7079d 100644 --- a/Include/Python.h +++ b/Include/Python.h -@@ -22,7 +22,15 @@ +@@ -34,6 +34,11 @@ + // version 3.13 and newer. #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 - # include - # include // FILE* -+# if defined(__FreeBSD__) && defined(_POSIX_SOURCE) -+# define _WANT_POSIX_SOURCE -+# undef _POSIX_SOURCE -+# endif # include // errno -+# if defined(_WANT_POSIX_SOURCE) -+# define _POSIX_SOURCE -+# undef _WANT_POSIX_SOURCE ++# if defined(__FreeBSD__) ++# ifndef EWOULDBLOCK ++# define EWOULDBLOCK EAGAIN /* Operation would block */ ++# endif +# endif + # include // FILE* + # include // getenv() # include // memcpy() - #endif - #ifndef MS_WINDOWS diff --git a/patches/3.12/02-freebsd-errno.patch b/patches/3.12/02-freebsd-errno.patch index 6c828db..eee81ce 100644 --- a/patches/3.12/02-freebsd-errno.patch +++ b/patches/3.12/02-freebsd-errno.patch @@ -1,20 +1,16 @@ diff --git a/Include/Python.h b/Include/Python.h -index 52a7aac6ba..c09deb9223 100644 +index fb2d32d7110..5b684c7079d 100644 --- a/Include/Python.h +++ b/Include/Python.h -@@ -22,7 +22,15 @@ +@@ -34,6 +34,11 @@ + // version 3.13 and newer. #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 - # include - # include // FILE* -+# if defined(__FreeBSD__) && defined(_POSIX_SOURCE) -+# define _WANT_POSIX_SOURCE -+# undef _POSIX_SOURCE -+# endif # include // errno -+# if defined(_WANT_POSIX_SOURCE) -+# define _POSIX_SOURCE -+# undef _WANT_POSIX_SOURCE ++# if defined(__FreeBSD__) ++# ifndef EWOULDBLOCK ++# define EWOULDBLOCK EAGAIN /* Operation would block */ ++# endif +# endif + # include // FILE* + # include // getenv() # include // memcpy() - #endif - #ifndef MS_WINDOWS diff --git a/patches/3.13/02-freebsd-errno.patch b/patches/3.13/02-freebsd-errno.patch new file mode 100644 index 0000000..eee81ce --- /dev/null +++ b/patches/3.13/02-freebsd-errno.patch @@ -0,0 +1,16 @@ +diff --git a/Include/Python.h b/Include/Python.h +index fb2d32d7110..5b684c7079d 100644 +--- a/Include/Python.h ++++ b/Include/Python.h +@@ -34,6 +34,11 @@ + // version 3.13 and newer. + #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 + # include // errno ++# if defined(__FreeBSD__) ++# ifndef EWOULDBLOCK ++# define EWOULDBLOCK EAGAIN /* Operation would block */ ++# endif ++# endif + # include // FILE* + # include // getenv() + # include // memcpy() diff --git a/patches/3.13/02-cosmo-sys-random.patch b/patches/3.13/03-cosmo-sys-random.patch similarity index 100% rename from patches/3.13/02-cosmo-sys-random.patch rename to patches/3.13/03-cosmo-sys-random.patch diff --git a/patches/3.13/03-getpath_noop-missing-stub.patch b/patches/3.13/04-getpath_noop-missing-stub.patch similarity index 100% rename from patches/3.13/03-getpath_noop-missing-stub.patch rename to patches/3.13/04-getpath_noop-missing-stub.patch diff --git a/patches/3.13/04-solaris-fcntlmodule.patch b/patches/3.13/05-solaris-fcntlmodule.patch similarity index 100% rename from patches/3.13/04-solaris-fcntlmodule.patch rename to patches/3.13/05-solaris-fcntlmodule.patch diff --git a/patches/3.13/05-relative-getpath-h.patch b/patches/3.13/06-relative-getpath-h.patch similarity index 100% rename from patches/3.13/05-relative-getpath-h.patch rename to patches/3.13/06-relative-getpath-h.patch diff --git a/patches/3.13/06-testcapimodule-gettimeofday.patch b/patches/3.13/07-testcapimodule-gettimeofday.patch similarity index 100% rename from patches/3.13/06-testcapimodule-gettimeofday.patch rename to patches/3.13/07-testcapimodule-gettimeofday.patch diff --git a/patches/3.9/02-freebsd-errno.patch b/patches/3.9/02-freebsd-errno.patch index d9a21f0..eee81ce 100644 --- a/patches/3.9/02-freebsd-errno.patch +++ b/patches/3.9/02-freebsd-errno.patch @@ -1,20 +1,16 @@ diff --git a/Include/Python.h b/Include/Python.h -index 7f7ed5981c..9499df113f 100644 +index fb2d32d7110..5b684c7079d 100644 --- a/Include/Python.h +++ b/Include/Python.h -@@ -29,7 +29,15 @@ - - #include - #ifdef HAVE_ERRNO_H -+# if defined(__FreeBSD__) && defined(_POSIX_SOURCE) -+# define _WANT_POSIX_SOURCE -+# undef _POSIX_SOURCE -+# endif - #include -+# if defined(_WANT_POSIX_SOURCE) -+# undef _WANT_POSIX_SOURCE -+# define _POSIX_SOURCE -+# endif - #endif - #include - #ifndef MS_WINDOWS +@@ -34,6 +34,11 @@ + // version 3.13 and newer. + #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 + # include // errno ++# if defined(__FreeBSD__) ++# ifndef EWOULDBLOCK ++# define EWOULDBLOCK EAGAIN /* Operation would block */ ++# endif ++# endif + # include // FILE* + # include // getenv() + # include // memcpy() From aec043a7381dec0b510775af6c366adfa7caf42c Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Sat, 14 Dec 2024 09:10:56 -0500 Subject: [PATCH 41/45] update errno patches --- patches/3.10/02-freebsd-errno.patch | 24 ++++++++++++------------ patches/3.11/02-freebsd-errno.patch | 14 +++++++------- patches/3.12/02-freebsd-errno.patch | 14 +++++++------- patches/3.9/02-freebsd-errno.patch | 24 ++++++++++++------------ 4 files changed, 38 insertions(+), 38 deletions(-) diff --git a/patches/3.10/02-freebsd-errno.patch b/patches/3.10/02-freebsd-errno.patch index eee81ce..4b3a1ad 100644 --- a/patches/3.10/02-freebsd-errno.patch +++ b/patches/3.10/02-freebsd-errno.patch @@ -1,16 +1,16 @@ diff --git a/Include/Python.h b/Include/Python.h -index fb2d32d7110..5b684c7079d 100644 +index d3186c32e35..55ed6a1e634 100644 --- a/Include/Python.h +++ b/Include/Python.h -@@ -34,6 +34,11 @@ - // version 3.13 and newer. - #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 - # include // errno -+# if defined(__FreeBSD__) -+# ifndef EWOULDBLOCK -+# define EWOULDBLOCK EAGAIN /* Operation would block */ -+# endif +@@ -30,6 +30,11 @@ + #include + #ifdef HAVE_ERRNO_H + #include ++#if defined(__FreeBSD__) ++# ifndef EWOULDBLOCK ++# define EWOULDBLOCK EAGAIN +# endif - # include // FILE* - # include // getenv() - # include // memcpy() ++#endif + #endif + #include + #ifndef MS_WINDOWS diff --git a/patches/3.11/02-freebsd-errno.patch b/patches/3.11/02-freebsd-errno.patch index eee81ce..2738ec2 100644 --- a/patches/3.11/02-freebsd-errno.patch +++ b/patches/3.11/02-freebsd-errno.patch @@ -1,16 +1,16 @@ diff --git a/Include/Python.h b/Include/Python.h -index fb2d32d7110..5b684c7079d 100644 +index 52a7aac6ba6..54fc034b90c 100644 --- a/Include/Python.h +++ b/Include/Python.h -@@ -34,6 +34,11 @@ - // version 3.13 and newer. - #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 +@@ -23,6 +23,11 @@ + # include + # include // FILE* # include // errno +# if defined(__FreeBSD__) +# ifndef EWOULDBLOCK -+# define EWOULDBLOCK EAGAIN /* Operation would block */ ++# define EWOULDBLOCK EAGAIN +# endif +# endif - # include // FILE* - # include // getenv() # include // memcpy() + #endif + #ifndef MS_WINDOWS diff --git a/patches/3.12/02-freebsd-errno.patch b/patches/3.12/02-freebsd-errno.patch index eee81ce..2738ec2 100644 --- a/patches/3.12/02-freebsd-errno.patch +++ b/patches/3.12/02-freebsd-errno.patch @@ -1,16 +1,16 @@ diff --git a/Include/Python.h b/Include/Python.h -index fb2d32d7110..5b684c7079d 100644 +index 52a7aac6ba6..54fc034b90c 100644 --- a/Include/Python.h +++ b/Include/Python.h -@@ -34,6 +34,11 @@ - // version 3.13 and newer. - #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 +@@ -23,6 +23,11 @@ + # include + # include // FILE* # include // errno +# if defined(__FreeBSD__) +# ifndef EWOULDBLOCK -+# define EWOULDBLOCK EAGAIN /* Operation would block */ ++# define EWOULDBLOCK EAGAIN +# endif +# endif - # include // FILE* - # include // getenv() # include // memcpy() + #endif + #ifndef MS_WINDOWS diff --git a/patches/3.9/02-freebsd-errno.patch b/patches/3.9/02-freebsd-errno.patch index eee81ce..4b3a1ad 100644 --- a/patches/3.9/02-freebsd-errno.patch +++ b/patches/3.9/02-freebsd-errno.patch @@ -1,16 +1,16 @@ diff --git a/Include/Python.h b/Include/Python.h -index fb2d32d7110..5b684c7079d 100644 +index d3186c32e35..55ed6a1e634 100644 --- a/Include/Python.h +++ b/Include/Python.h -@@ -34,6 +34,11 @@ - // version 3.13 and newer. - #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 - # include // errno -+# if defined(__FreeBSD__) -+# ifndef EWOULDBLOCK -+# define EWOULDBLOCK EAGAIN /* Operation would block */ -+# endif +@@ -30,6 +30,11 @@ + #include + #ifdef HAVE_ERRNO_H + #include ++#if defined(__FreeBSD__) ++# ifndef EWOULDBLOCK ++# define EWOULDBLOCK EAGAIN +# endif - # include // FILE* - # include // getenv() - # include // memcpy() ++#endif + #endif + #include + #ifndef MS_WINDOWS From f6e1a9b37a91004f47f7a50012e73196e256a0a5 Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Sat, 14 Dec 2024 09:22:44 -0500 Subject: [PATCH 42/45] Revert "update errno patches" This reverts commit aec043a7381dec0b510775af6c366adfa7caf42c. --- patches/3.10/02-freebsd-errno.patch | 24 ++++++++++++------------ patches/3.11/02-freebsd-errno.patch | 14 +++++++------- patches/3.12/02-freebsd-errno.patch | 14 +++++++------- patches/3.9/02-freebsd-errno.patch | 24 ++++++++++++------------ 4 files changed, 38 insertions(+), 38 deletions(-) diff --git a/patches/3.10/02-freebsd-errno.patch b/patches/3.10/02-freebsd-errno.patch index 4b3a1ad..eee81ce 100644 --- a/patches/3.10/02-freebsd-errno.patch +++ b/patches/3.10/02-freebsd-errno.patch @@ -1,16 +1,16 @@ diff --git a/Include/Python.h b/Include/Python.h -index d3186c32e35..55ed6a1e634 100644 +index fb2d32d7110..5b684c7079d 100644 --- a/Include/Python.h +++ b/Include/Python.h -@@ -30,6 +30,11 @@ - #include - #ifdef HAVE_ERRNO_H - #include -+#if defined(__FreeBSD__) -+# ifndef EWOULDBLOCK -+# define EWOULDBLOCK EAGAIN +@@ -34,6 +34,11 @@ + // version 3.13 and newer. + #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 + # include // errno ++# if defined(__FreeBSD__) ++# ifndef EWOULDBLOCK ++# define EWOULDBLOCK EAGAIN /* Operation would block */ ++# endif +# endif -+#endif - #endif - #include - #ifndef MS_WINDOWS + # include // FILE* + # include // getenv() + # include // memcpy() diff --git a/patches/3.11/02-freebsd-errno.patch b/patches/3.11/02-freebsd-errno.patch index 2738ec2..eee81ce 100644 --- a/patches/3.11/02-freebsd-errno.patch +++ b/patches/3.11/02-freebsd-errno.patch @@ -1,16 +1,16 @@ diff --git a/Include/Python.h b/Include/Python.h -index 52a7aac6ba6..54fc034b90c 100644 +index fb2d32d7110..5b684c7079d 100644 --- a/Include/Python.h +++ b/Include/Python.h -@@ -23,6 +23,11 @@ - # include - # include // FILE* +@@ -34,6 +34,11 @@ + // version 3.13 and newer. + #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 # include // errno +# if defined(__FreeBSD__) +# ifndef EWOULDBLOCK -+# define EWOULDBLOCK EAGAIN ++# define EWOULDBLOCK EAGAIN /* Operation would block */ +# endif +# endif + # include // FILE* + # include // getenv() # include // memcpy() - #endif - #ifndef MS_WINDOWS diff --git a/patches/3.12/02-freebsd-errno.patch b/patches/3.12/02-freebsd-errno.patch index 2738ec2..eee81ce 100644 --- a/patches/3.12/02-freebsd-errno.patch +++ b/patches/3.12/02-freebsd-errno.patch @@ -1,16 +1,16 @@ diff --git a/Include/Python.h b/Include/Python.h -index 52a7aac6ba6..54fc034b90c 100644 +index fb2d32d7110..5b684c7079d 100644 --- a/Include/Python.h +++ b/Include/Python.h -@@ -23,6 +23,11 @@ - # include - # include // FILE* +@@ -34,6 +34,11 @@ + // version 3.13 and newer. + #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 # include // errno +# if defined(__FreeBSD__) +# ifndef EWOULDBLOCK -+# define EWOULDBLOCK EAGAIN ++# define EWOULDBLOCK EAGAIN /* Operation would block */ +# endif +# endif + # include // FILE* + # include // getenv() # include // memcpy() - #endif - #ifndef MS_WINDOWS diff --git a/patches/3.9/02-freebsd-errno.patch b/patches/3.9/02-freebsd-errno.patch index 4b3a1ad..eee81ce 100644 --- a/patches/3.9/02-freebsd-errno.patch +++ b/patches/3.9/02-freebsd-errno.patch @@ -1,16 +1,16 @@ diff --git a/Include/Python.h b/Include/Python.h -index d3186c32e35..55ed6a1e634 100644 +index fb2d32d7110..5b684c7079d 100644 --- a/Include/Python.h +++ b/Include/Python.h -@@ -30,6 +30,11 @@ - #include - #ifdef HAVE_ERRNO_H - #include -+#if defined(__FreeBSD__) -+# ifndef EWOULDBLOCK -+# define EWOULDBLOCK EAGAIN +@@ -34,6 +34,11 @@ + // version 3.13 and newer. + #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 + # include // errno ++# if defined(__FreeBSD__) ++# ifndef EWOULDBLOCK ++# define EWOULDBLOCK EAGAIN /* Operation would block */ ++# endif +# endif -+#endif - #endif - #include - #ifndef MS_WINDOWS + # include // FILE* + # include // getenv() + # include // memcpy() From f0d59dbc914714fb49bb7d169767e05fcfa5a7f7 Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Sat, 14 Dec 2024 09:22:45 -0500 Subject: [PATCH 43/45] Revert "update freebsd errno patch" This reverts commit 79134fe078b85f789b867e688a0ba8fefa637e15. --- patches/3.10/02-freebsd-errno.patch | 30 +++++++++++-------- patches/3.11/02-freebsd-errno.patch | 22 ++++++++------ patches/3.12/02-freebsd-errno.patch | 22 ++++++++------ ...random.patch => 02-cosmo-sys-random.patch} | 0 patches/3.13/02-freebsd-errno.patch | 16 ---------- ...tch => 03-getpath_noop-missing-stub.patch} | 0 ...ule.patch => 04-solaris-fcntlmodule.patch} | 0 ...th-h.patch => 05-relative-getpath-h.patch} | 0 ...h => 06-testcapimodule-gettimeofday.patch} | 0 patches/3.9/02-freebsd-errno.patch | 30 +++++++++++-------- 10 files changed, 60 insertions(+), 60 deletions(-) rename patches/3.13/{03-cosmo-sys-random.patch => 02-cosmo-sys-random.patch} (100%) delete mode 100644 patches/3.13/02-freebsd-errno.patch rename patches/3.13/{04-getpath_noop-missing-stub.patch => 03-getpath_noop-missing-stub.patch} (100%) rename patches/3.13/{05-solaris-fcntlmodule.patch => 04-solaris-fcntlmodule.patch} (100%) rename patches/3.13/{06-relative-getpath-h.patch => 05-relative-getpath-h.patch} (100%) rename patches/3.13/{07-testcapimodule-gettimeofday.patch => 06-testcapimodule-gettimeofday.patch} (100%) diff --git a/patches/3.10/02-freebsd-errno.patch b/patches/3.10/02-freebsd-errno.patch index eee81ce..d9a21f0 100644 --- a/patches/3.10/02-freebsd-errno.patch +++ b/patches/3.10/02-freebsd-errno.patch @@ -1,16 +1,20 @@ diff --git a/Include/Python.h b/Include/Python.h -index fb2d32d7110..5b684c7079d 100644 +index 7f7ed5981c..9499df113f 100644 --- a/Include/Python.h +++ b/Include/Python.h -@@ -34,6 +34,11 @@ - // version 3.13 and newer. - #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 - # include // errno -+# if defined(__FreeBSD__) -+# ifndef EWOULDBLOCK -+# define EWOULDBLOCK EAGAIN /* Operation would block */ -+# endif -+# endif - # include // FILE* - # include // getenv() - # include // memcpy() +@@ -29,7 +29,15 @@ + + #include + #ifdef HAVE_ERRNO_H ++# if defined(__FreeBSD__) && defined(_POSIX_SOURCE) ++# define _WANT_POSIX_SOURCE ++# undef _POSIX_SOURCE ++# endif + #include ++# if defined(_WANT_POSIX_SOURCE) ++# undef _WANT_POSIX_SOURCE ++# define _POSIX_SOURCE ++# endif + #endif + #include + #ifndef MS_WINDOWS diff --git a/patches/3.11/02-freebsd-errno.patch b/patches/3.11/02-freebsd-errno.patch index eee81ce..6c828db 100644 --- a/patches/3.11/02-freebsd-errno.patch +++ b/patches/3.11/02-freebsd-errno.patch @@ -1,16 +1,20 @@ diff --git a/Include/Python.h b/Include/Python.h -index fb2d32d7110..5b684c7079d 100644 +index 52a7aac6ba..c09deb9223 100644 --- a/Include/Python.h +++ b/Include/Python.h -@@ -34,6 +34,11 @@ - // version 3.13 and newer. +@@ -22,7 +22,15 @@ #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 + # include + # include // FILE* ++# if defined(__FreeBSD__) && defined(_POSIX_SOURCE) ++# define _WANT_POSIX_SOURCE ++# undef _POSIX_SOURCE ++# endif # include // errno -+# if defined(__FreeBSD__) -+# ifndef EWOULDBLOCK -+# define EWOULDBLOCK EAGAIN /* Operation would block */ -+# endif ++# if defined(_WANT_POSIX_SOURCE) ++# define _POSIX_SOURCE ++# undef _WANT_POSIX_SOURCE +# endif - # include // FILE* - # include // getenv() # include // memcpy() + #endif + #ifndef MS_WINDOWS diff --git a/patches/3.12/02-freebsd-errno.patch b/patches/3.12/02-freebsd-errno.patch index eee81ce..6c828db 100644 --- a/patches/3.12/02-freebsd-errno.patch +++ b/patches/3.12/02-freebsd-errno.patch @@ -1,16 +1,20 @@ diff --git a/Include/Python.h b/Include/Python.h -index fb2d32d7110..5b684c7079d 100644 +index 52a7aac6ba..c09deb9223 100644 --- a/Include/Python.h +++ b/Include/Python.h -@@ -34,6 +34,11 @@ - // version 3.13 and newer. +@@ -22,7 +22,15 @@ #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 + # include + # include // FILE* ++# if defined(__FreeBSD__) && defined(_POSIX_SOURCE) ++# define _WANT_POSIX_SOURCE ++# undef _POSIX_SOURCE ++# endif # include // errno -+# if defined(__FreeBSD__) -+# ifndef EWOULDBLOCK -+# define EWOULDBLOCK EAGAIN /* Operation would block */ -+# endif ++# if defined(_WANT_POSIX_SOURCE) ++# define _POSIX_SOURCE ++# undef _WANT_POSIX_SOURCE +# endif - # include // FILE* - # include // getenv() # include // memcpy() + #endif + #ifndef MS_WINDOWS diff --git a/patches/3.13/03-cosmo-sys-random.patch b/patches/3.13/02-cosmo-sys-random.patch similarity index 100% rename from patches/3.13/03-cosmo-sys-random.patch rename to patches/3.13/02-cosmo-sys-random.patch diff --git a/patches/3.13/02-freebsd-errno.patch b/patches/3.13/02-freebsd-errno.patch deleted file mode 100644 index eee81ce..0000000 --- a/patches/3.13/02-freebsd-errno.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff --git a/Include/Python.h b/Include/Python.h -index fb2d32d7110..5b684c7079d 100644 ---- a/Include/Python.h -+++ b/Include/Python.h -@@ -34,6 +34,11 @@ - // version 3.13 and newer. - #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 - # include // errno -+# if defined(__FreeBSD__) -+# ifndef EWOULDBLOCK -+# define EWOULDBLOCK EAGAIN /* Operation would block */ -+# endif -+# endif - # include // FILE* - # include // getenv() - # include // memcpy() diff --git a/patches/3.13/04-getpath_noop-missing-stub.patch b/patches/3.13/03-getpath_noop-missing-stub.patch similarity index 100% rename from patches/3.13/04-getpath_noop-missing-stub.patch rename to patches/3.13/03-getpath_noop-missing-stub.patch diff --git a/patches/3.13/05-solaris-fcntlmodule.patch b/patches/3.13/04-solaris-fcntlmodule.patch similarity index 100% rename from patches/3.13/05-solaris-fcntlmodule.patch rename to patches/3.13/04-solaris-fcntlmodule.patch diff --git a/patches/3.13/06-relative-getpath-h.patch b/patches/3.13/05-relative-getpath-h.patch similarity index 100% rename from patches/3.13/06-relative-getpath-h.patch rename to patches/3.13/05-relative-getpath-h.patch diff --git a/patches/3.13/07-testcapimodule-gettimeofday.patch b/patches/3.13/06-testcapimodule-gettimeofday.patch similarity index 100% rename from patches/3.13/07-testcapimodule-gettimeofday.patch rename to patches/3.13/06-testcapimodule-gettimeofday.patch diff --git a/patches/3.9/02-freebsd-errno.patch b/patches/3.9/02-freebsd-errno.patch index eee81ce..d9a21f0 100644 --- a/patches/3.9/02-freebsd-errno.patch +++ b/patches/3.9/02-freebsd-errno.patch @@ -1,16 +1,20 @@ diff --git a/Include/Python.h b/Include/Python.h -index fb2d32d7110..5b684c7079d 100644 +index 7f7ed5981c..9499df113f 100644 --- a/Include/Python.h +++ b/Include/Python.h -@@ -34,6 +34,11 @@ - // version 3.13 and newer. - #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 - # include // errno -+# if defined(__FreeBSD__) -+# ifndef EWOULDBLOCK -+# define EWOULDBLOCK EAGAIN /* Operation would block */ -+# endif -+# endif - # include // FILE* - # include // getenv() - # include // memcpy() +@@ -29,7 +29,15 @@ + + #include + #ifdef HAVE_ERRNO_H ++# if defined(__FreeBSD__) && defined(_POSIX_SOURCE) ++# define _WANT_POSIX_SOURCE ++# undef _POSIX_SOURCE ++# endif + #include ++# if defined(_WANT_POSIX_SOURCE) ++# undef _WANT_POSIX_SOURCE ++# define _POSIX_SOURCE ++# endif + #endif + #include + #ifndef MS_WINDOWS From c966fd267c88b83e10dcfec018b86d849eccc710 Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Sat, 14 Dec 2024 09:23:49 -0500 Subject: [PATCH 44/45] Revert "Revert "Revert "remove freebsd errno patch""" This reverts commit f0a0935c4b509a93f0638c8e6962e8c8d7778503. --- patches/3.13/02-freebsd-errno.patch | 20 +++++++++++++++++++ ...random.patch => 03-cosmo-sys-random.patch} | 0 ...tch => 04-getpath_noop-missing-stub.patch} | 0 ...ule.patch => 05-solaris-fcntlmodule.patch} | 0 ...th-h.patch => 06-relative-getpath-h.patch} | 0 ...h => 07-testcapimodule-gettimeofday.patch} | 0 6 files changed, 20 insertions(+) create mode 100644 patches/3.13/02-freebsd-errno.patch rename patches/3.13/{02-cosmo-sys-random.patch => 03-cosmo-sys-random.patch} (100%) rename patches/3.13/{03-getpath_noop-missing-stub.patch => 04-getpath_noop-missing-stub.patch} (100%) rename patches/3.13/{04-solaris-fcntlmodule.patch => 05-solaris-fcntlmodule.patch} (100%) rename patches/3.13/{05-relative-getpath-h.patch => 06-relative-getpath-h.patch} (100%) rename patches/3.13/{06-testcapimodule-gettimeofday.patch => 07-testcapimodule-gettimeofday.patch} (100%) diff --git a/patches/3.13/02-freebsd-errno.patch b/patches/3.13/02-freebsd-errno.patch new file mode 100644 index 0000000..040cd69 --- /dev/null +++ b/patches/3.13/02-freebsd-errno.patch @@ -0,0 +1,20 @@ +diff --git a/Include/Python.h b/Include/Python.h +index fb2d32d7110..4b8bf901bdf 100644 +--- a/Include/Python.h ++++ b/Include/Python.h +@@ -33,7 +33,15 @@ + // The and headers are not included by limited C API + // version 3.13 and newer. + #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000 ++# if defined(__FreeBSD__) && defined(_POSIX_SOURCE) ++# define _WANT_POSIX_SOURCE ++# undef _POSIX_SOURCE ++# endif + # include // errno ++# if defined(_WANT_POSIX_SOURCE) ++# define _POSIX_SOURCE ++# undef _WANT_POSIX_SOURCE ++# endif + # include // FILE* + # include // getenv() + # include // memcpy() diff --git a/patches/3.13/02-cosmo-sys-random.patch b/patches/3.13/03-cosmo-sys-random.patch similarity index 100% rename from patches/3.13/02-cosmo-sys-random.patch rename to patches/3.13/03-cosmo-sys-random.patch diff --git a/patches/3.13/03-getpath_noop-missing-stub.patch b/patches/3.13/04-getpath_noop-missing-stub.patch similarity index 100% rename from patches/3.13/03-getpath_noop-missing-stub.patch rename to patches/3.13/04-getpath_noop-missing-stub.patch diff --git a/patches/3.13/04-solaris-fcntlmodule.patch b/patches/3.13/05-solaris-fcntlmodule.patch similarity index 100% rename from patches/3.13/04-solaris-fcntlmodule.patch rename to patches/3.13/05-solaris-fcntlmodule.patch diff --git a/patches/3.13/05-relative-getpath-h.patch b/patches/3.13/06-relative-getpath-h.patch similarity index 100% rename from patches/3.13/05-relative-getpath-h.patch rename to patches/3.13/06-relative-getpath-h.patch diff --git a/patches/3.13/06-testcapimodule-gettimeofday.patch b/patches/3.13/07-testcapimodule-gettimeofday.patch similarity index 100% rename from patches/3.13/06-testcapimodule-gettimeofday.patch rename to patches/3.13/07-testcapimodule-gettimeofday.patch From b339e3dc94f930e87fa1819f4a2b9b703896d136 Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Sat, 14 Dec 2024 10:13:44 -0500 Subject: [PATCH 45/45] override errno hacks --- patches/3.13/02-freebsd-errno.patch | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/patches/3.13/02-freebsd-errno.patch b/patches/3.13/02-freebsd-errno.patch index 040cd69..a40dda1 100644 --- a/patches/3.13/02-freebsd-errno.patch +++ b/patches/3.13/02-freebsd-errno.patch @@ -18,3 +18,26 @@ index fb2d32d7110..4b8bf901bdf 100644 # include // FILE* # include // getenv() # include // memcpy() +diff --git a/Modules/errnomodule.c b/Modules/errnomodule.c +index 3f96f2f846d..db1a2d23a74 100644 +--- a/Modules/errnomodule.c ++++ b/Modules/errnomodule.c +@@ -6,6 +6,18 @@ + # define Py_LIMITED_API 0x030d0000 + #endif + ++#if defined(__FreeBSD__) ++# if defined(_POSIX_SOURCE) ++# define _WANT_POSIX_SOURCE ++# undef _POSIX_SOURCE ++# endif ++# include ++# if defined(_WANT_POSIX_SOURCE) ++# define _POSIX_SOURCE ++# undef _WANT_POSIX_SOURCE ++# endif ++#endif ++ + #include "Python.h" + #include // EPIPE +