-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
4,174 additions
and
649 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
Remove the use of functions that don't exist in older mingws. | ||
|
||
From: Tom Rothamel <[email protected]> | ||
|
||
For now, we're targeting Ubuntu 20.04 as the build platform, and using | ||
the system mingw, which is missing some (newer?) functions. | ||
--- | ||
Modules/_localemodule.c | 5 +++-- | ||
Python/fileutils.c | 3 ++- | ||
Python/pylifecycle.c | 2 ++ | ||
3 files changed, 7 insertions(+), 3 deletions(-) | ||
|
||
diff --git a/Modules/_localemodule.c b/Modules/_localemodule.c | ||
index 2e353bb..18f3164 100644 | ||
--- a/Modules/_localemodule.c | ||
+++ b/Modules/_localemodule.c | ||
@@ -183,7 +183,8 @@ locale_decode_monetary(PyObject *dict, struct lconv *lc) | ||
#define GET_LOCALE_STRING(ATTR) PyUnicode_DecodeLocale(lc->ATTR, NULL) | ||
#else /* MS_WINDOWS */ | ||
/* Use _W_* fields of Windows struct lconv */ | ||
-#define GET_LOCALE_STRING(ATTR) PyUnicode_FromWideChar(lc->_W_ ## ATTR, -1) | ||
+/* #define GET_LOCALE_STRING(ATTR) PyUnicode_FromWideChar(lc->_W_ ## ATTR, -1) */ | ||
+#define GET_LOCALE_STRING(ATTR) PyUnicode_DecodeLocale(lc->ATTR, NULL) | ||
#endif /* MS_WINDOWS */ | ||
|
||
int res = -1; | ||
@@ -255,7 +256,7 @@ PyLocale_localeconv(PyObject* self, PyObject *Py_UNUSED(ignored)) | ||
|
||
#ifdef MS_WINDOWS | ||
/* Use _W_* fields of Windows struct lconv */ | ||
-#define GET_LOCALE_STRING(ATTR) PyUnicode_FromWideChar(lc->_W_ ## ATTR, -1) | ||
+#define GET_LOCALE_STRING(ATTR) PyUnicode_DecodeLocale(lc->ATTR, NULL) | ||
#else | ||
#define GET_LOCALE_STRING(ATTR) PyUnicode_DecodeLocale(lc->ATTR, NULL) | ||
#endif | ||
diff --git a/Python/fileutils.c b/Python/fileutils.c | ||
index 26e97df..93cbb1d 100644 | ||
--- a/Python/fileutils.c | ||
+++ b/Python/fileutils.c | ||
@@ -2246,7 +2246,8 @@ _Py_GetLocaleconvNumeric(struct lconv *lc, | ||
#define GET_LOCALE_STRING(ATTR) PyUnicode_DecodeLocale(lc->ATTR, NULL) | ||
#else /* MS_WINDOWS */ | ||
/* Use _W_* fields of Windows strcut lconv */ | ||
-#define GET_LOCALE_STRING(ATTR) PyUnicode_FromWideChar(lc->_W_ ## ATTR, -1) | ||
+#define GET_LOCALE_STRING(ATTR) PyUnicode_DecodeLocale(lc->ATTR, NULL) | ||
+/* #define GET_LOCALE_STRING(ATTR) PyUnicode_FromWideChar(lc->_W_ ## ATTR, -1) */ | ||
#endif /* MS_WINDOWS */ | ||
|
||
int res = -1; | ||
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c | ||
index 60f091c..73af037 100644 | ||
--- a/Python/pylifecycle.c | ||
+++ b/Python/pylifecycle.c | ||
@@ -305,6 +305,7 @@ _coerce_default_locale_settings(int warn, const _LocaleCoercionTarget *target) | ||
/* Reset locale back to currently configured defaults */ | ||
_Py_SetLocaleFromEnv(LC_ALL); | ||
|
||
+#if 0 | ||
/* Set the relevant locale environment variable */ | ||
if (setenv("LC_CTYPE", newloc, 1)) { | ||
fprintf(stderr, | ||
@@ -314,6 +315,7 @@ _coerce_default_locale_settings(int warn, const _LocaleCoercionTarget *target) | ||
if (warn) { | ||
fprintf(stderr, C_LOCALE_COERCION_WARNING, newloc); | ||
} | ||
+#endif | ||
|
||
/* Reconfigure with the overridden environment variables */ | ||
_Py_SetLocaleFromEnv(LC_ALL); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
Allow Python to be cross-compiled for darwin. | ||
|
||
From: Tom Rothamel <[email protected]> | ||
|
||
|
||
--- | ||
configure.ac | 59 +++++++++++++++++----------------------------------------- | ||
1 file changed, 17 insertions(+), 42 deletions(-) | ||
|
||
diff --git a/configure.ac b/configure.ac | ||
index 431d661..ba3ea36 100644 | ||
--- a/configure.ac | ||
+++ b/configure.ac | ||
@@ -390,6 +390,9 @@ then | ||
# ac_sys_system and ac_sys_release are used for setting | ||
# a lot of different things including 'define_xopen_source' | ||
# in the case statement below. | ||
+ ac_sys_release= | ||
+ | ||
+ | ||
case "$host" in | ||
*-*-linux-android*) | ||
ac_sys_system=Linux-android | ||
@@ -403,12 +406,15 @@ then | ||
*-*-vxworks*) | ||
ac_sys_system=VxWorks | ||
;; | ||
+ *-*-darwin*) | ||
+ ac_sys_system=Darwin | ||
+ ac_sys_release=10.0 | ||
+ ;; | ||
*) | ||
# for now, limit cross builds to known configurations | ||
MACHDEP="unknown" | ||
AC_MSG_ERROR([cross build not supported for $host]) | ||
esac | ||
- ac_sys_release= | ||
else | ||
ac_sys_system=`uname -s` | ||
if test "$ac_sys_system" = "AIX" \ | ||
@@ -449,6 +455,15 @@ if test "$cross_compiling" = yes; then | ||
*-*-cygwin*) | ||
_host_cpu= | ||
;; | ||
+ *-*-darwin*) | ||
+ case "$host_cpu" in | ||
+ arm*) | ||
+ _host_cpu=arm | ||
+ ;; | ||
+ *) | ||
+ _host_cpu=$host_cpu | ||
+ esac | ||
+ ;; | ||
*-*-vxworks*) | ||
_host_cpu=$host_cpu | ||
;; | ||
@@ -1221,17 +1236,6 @@ then | ||
ARFLAGS="rcs" | ||
fi | ||
|
||
-AC_CHECK_TOOLS([READELF], [readelf], [:]) | ||
-if test "$cross_compiling" = yes; then | ||
- case "$READELF" in | ||
- readelf|:) | ||
- AC_MSG_ERROR([readelf for the host is required for cross builds]) | ||
- ;; | ||
- esac | ||
-fi | ||
-AC_SUBST(READELF) | ||
- | ||
- | ||
case $MACHDEP in | ||
hp*|HP*) | ||
# install -d does not work on HP-UX | ||
@@ -2503,35 +2507,7 @@ case $ac_sys_system/$ac_sys_release in | ||
} | ||
]])],[ac_osx_32bit=yes],[ac_osx_32bit=no],[ac_osx_32bit=yes]) | ||
|
||
- if test "${ac_osx_32bit}" = "yes"; then | ||
- case `/usr/bin/arch` in | ||
- i386) | ||
- MACOSX_DEFAULT_ARCH="i386" | ||
- ;; | ||
- ppc) | ||
- MACOSX_DEFAULT_ARCH="ppc" | ||
- ;; | ||
- *) | ||
- AC_MSG_ERROR([Unexpected output of 'arch' on macOS]) | ||
- ;; | ||
- esac | ||
- else | ||
- case `/usr/bin/arch` in | ||
- i386) | ||
- MACOSX_DEFAULT_ARCH="x86_64" | ||
- ;; | ||
- ppc) | ||
- MACOSX_DEFAULT_ARCH="ppc64" | ||
- ;; | ||
- arm64) | ||
- MACOSX_DEFAULT_ARCH="arm64" | ||
- ;; | ||
- *) | ||
- AC_MSG_ERROR([Unexpected output of 'arch' on macOS]) | ||
- ;; | ||
- esac | ||
- | ||
- fi | ||
+ MACOSX_DEFAULT_ARCH="x86_64" | ||
|
||
LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only ${MACOSX_DEFAULT_ARCH}" | ||
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Fix an issue where overlapped.c and _winapi.c define the same type. | ||
|
||
From: Tom Rothamel <[email protected]> | ||
|
||
|
||
--- | ||
Modules/overlapped.c | 2 +- | ||
1 file changed, 1 insertion(+), 1 deletion(-) | ||
|
||
diff --git a/Modules/overlapped.c b/Modules/overlapped.c | ||
index cd7869f..319ea0a 100644 | ||
--- a/Modules/overlapped.c | ||
+++ b/Modules/overlapped.c | ||
@@ -1756,7 +1756,7 @@ static PyGetSetDef Overlapped_getsets[] = { | ||
{NULL}, | ||
}; | ||
|
||
-PyTypeObject OverlappedType = { | ||
+static PyTypeObject OverlappedType = { | ||
PyVarObject_HEAD_INIT(NULL, 0) | ||
/* tp_name */ "_overlapped.Overlapped", | ||
/* tp_basicsize */ sizeof(OverlappedObject), |
34 changes: 34 additions & 0 deletions
34
patches/Python-3.12.8/fix-ssl-dont-use-enum_certificates.diff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
Do not use enum_certificates, as it's not available on mingw. | ||
|
||
From: Tom Rothamel <[email protected]> | ||
|
||
|
||
--- | ||
Lib/ssl.py | 7 +------ | ||
1 file changed, 1 insertion(+), 6 deletions(-) | ||
|
||
diff --git a/Lib/ssl.py b/Lib/ssl.py | ||
index 30f4e59..21007cc 100644 | ||
--- a/Lib/ssl.py | ||
+++ b/Lib/ssl.py | ||
@@ -249,9 +249,6 @@ class _TLSMessageType(_IntEnum): | ||
CHANGE_CIPHER_SPEC = 0x0101 | ||
|
||
|
||
-if sys.platform == "win32": | ||
- from _ssl import enum_certificates, enum_crls | ||
- | ||
from socket import socket, SOCK_STREAM, create_connection | ||
from socket import SOL_SOCKET, SO_TYPE | ||
import socket as _socket | ||
@@ -569,9 +566,7 @@ class SSLContext(_SSLContext): | ||
def load_default_certs(self, purpose=Purpose.SERVER_AUTH): | ||
if not isinstance(purpose, _ASN1Object): | ||
raise TypeError(purpose) | ||
- if sys.platform == "win32": | ||
- for storename in self._windows_cert_stores: | ||
- self._load_windows_store_certs(storename, purpose) | ||
+ | ||
self.set_default_verify_paths() | ||
|
||
if hasattr(_SSLContext, 'minimum_version'): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
commit 60889d78308534222071d73dc38f2a43878b3d9b | ||
Author: Tom Rothamel <[email protected]> | ||
Date: Sun Sep 22 04:11:08 2024 -0400 | ||
|
||
Disable the system call on iOS. | ||
|
||
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c | ||
index 6fb2fc8..7dcb402 100644 | ||
--- a/Modules/posixmodule.c | ||
+++ b/Modules/posixmodule.c | ||
@@ -4978,6 +4978,7 @@ os_rmdir_impl(PyObject *module, path_t *path, int dir_fd) | ||
Py_RETURN_NONE; | ||
} | ||
|
||
+#undef HAVE_SYSTEM | ||
|
||
#ifdef HAVE_SYSTEM | ||
#ifdef MS_WINDOWS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Disable multiarch support. | ||
|
||
From: Tom Rothamel <[email protected]> | ||
|
||
Since everything is a croos-compile, it's not needed. | ||
--- | ||
setup.py | 2 ++ | ||
1 file changed, 2 insertions(+) | ||
|
||
diff --git a/setup.py b/setup.py | ||
index c6023e1..dba2d0e 100644 | ||
--- a/setup.py | ||
+++ b/setup.py | ||
@@ -636,6 +636,8 @@ class PyBuildExt(build_ext): | ||
def add_multiarch_paths(self): | ||
# Debian/Ubuntu multiarch support. | ||
# https://wiki.ubuntu.com/MultiarchSpec | ||
+ return | ||
+ | ||
tmpfile = os.path.join(self.build_temp, 'multiarch') | ||
if not os.path.exists(self.build_temp): | ||
os.makedirs(self.build_temp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
Make sure there is only one DllMain. | ||
|
||
From: Tom Rothamel <[email protected]> | ||
|
||
|
||
--- | ||
Modules/_ctypes/callbacks.c | 12 ------------ | ||
PC/dl_nt.c | 3 +++ | ||
2 files changed, 3 insertions(+), 12 deletions(-) | ||
|
||
diff --git a/Modules/_ctypes/callbacks.c b/Modules/_ctypes/callbacks.c | ||
index e6e1018..37bf219 100644 | ||
--- a/Modules/_ctypes/callbacks.c | ||
+++ b/Modules/_ctypes/callbacks.c | ||
@@ -600,18 +600,6 @@ STDAPI DllCanUnloadNow(void) | ||
return result; | ||
} | ||
|
||
-#ifndef Py_NO_ENABLE_SHARED | ||
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvRes) | ||
-{ | ||
- switch(fdwReason) { | ||
- case DLL_PROCESS_ATTACH: | ||
- DisableThreadLibraryCalls(hinstDLL); | ||
- break; | ||
- } | ||
- return TRUE; | ||
-} | ||
-#endif | ||
- | ||
#endif | ||
|
||
/* | ||
diff --git a/PC/dl_nt.c b/PC/dl_nt.c | ||
index 7f17ee1..442f385 100644 | ||
--- a/PC/dl_nt.c | ||
+++ b/PC/dl_nt.c | ||
@@ -30,6 +30,9 @@ BOOL WINAPI DllMain (HANDLE hInst, | ||
case DLL_PROCESS_DETACH: | ||
break; | ||
} | ||
+ | ||
+ DisableThreadLibraryCalls(hInst); | ||
+ | ||
return TRUE; | ||
} | ||
|
Oops, something went wrong.