From 6d9a1d3c937b040cfafe838b28be429cf800c3fb Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Sat, 11 Dec 2021 17:43:42 +0000 Subject: [PATCH] Ports: Update Python to 3.10.1 :^) This was released a couple of days ago, on 2021-12-06 and contains various changes that we previously needed custom patches for, so we are now able to remove those and compile more unchanged upstream sources. Thanks to Rodrigo for making that effort! :^) --- Ports/AvailablePorts.md | 2 +- Ports/python3/patches/ReadMe.md | 16 -------- .../patches/define-have-sigset-t.patch | 4 +- .../patches/define-py-force-utf8-locale.patch | 4 +- Ports/python3/patches/fix-autoconf.patch | 35 ++++++++-------- Ports/python3/patches/http-client.patch | 24 ----------- Ports/python3/patches/include-sys-uio.patch | 4 +- Ports/python3/patches/tweak-setup-py.patch | 41 ------------------- Ports/python3/patches/xmlrcp_client.patch | 27 ------------ Ports/python3/version.sh | 6 +-- 10 files changed, 28 insertions(+), 135 deletions(-) delete mode 100644 Ports/python3/patches/http-client.patch delete mode 100644 Ports/python3/patches/tweak-setup-py.patch delete mode 100644 Ports/python3/patches/xmlrcp_client.patch diff --git a/Ports/AvailablePorts.md b/Ports/AvailablePorts.md index 3bb9861514..4caa9f8db9 100644 --- a/Ports/AvailablePorts.md +++ b/Ports/AvailablePorts.md @@ -140,7 +140,7 @@ Please make sure to keep this list up to date when adding and updating ports. :^ | [`printf`](printf/) | printf (OpenBSD) | 6.6 | https://github.com/ibara/libpuffy | | [`pt2-clone`](pt2-clone/) | ProTracker 2 clone | 1.28 | https://github.com/8bitbubsy/pt2-clone | | [`pv`](pv/) | Pipe Viewer | 1.6.20 | http://www.ivarch.com/programs/pv.shtml | -| [`python3`](python3/) | Python | 3.10.0 | https://www.python.org/ | +| [`python3`](python3/) | Python | 3.10.1 | https://www.python.org/ | | [`quake`](quake/) | Quake | 0.65 | https://github.com/SerenityOS/SerenityQuake | | [`quake2`](quake2/) | QuakeII | 0.1 | https://github.com/SerenityOS/SerenityQuakeII | | [`r0`](r0/) | r0 (minimalistic commandline hexadecimal editor) | 0.8 | https://github.com/radareorg/r0 | diff --git a/Ports/python3/patches/ReadMe.md b/Ports/python3/patches/ReadMe.md index b1c58da503..7b2e792d5c 100644 --- a/Ports/python3/patches/ReadMe.md +++ b/Ports/python3/patches/ReadMe.md @@ -15,19 +15,3 @@ Enforce UTF-8 as encoding by defining `_Py_FORCE_UTF8_LOCALE`. ## `fix-autoconf.patch` As usual, make the `configure` script recognize Serenity. Also set `MACHDEP` (which is used for `sys.platform`) to a version-less `serenityos`, even when not cross-compiling. - -## `http-client.patch` - -Allows HTTPConnection to work without the TCP_NODELAY socket option, as this is not supported by Serenity. - -## `tweak-setup-py.patch` - -Make some tweaks to Python's `setup.py` files: - -- Add `/usr/local/lib` / `/usr/local/include` to the system lib / include dirs, relative to the sysroot when crosscompiling. These are by default only included when not crosscompiling for some reason. -- Add `/usr/local/include/ncurses` to the curses include paths so it can build the `_curses` module. This is by default included for a bunch of extensions, but not `_curses`. -- Add `/usr/local/includes/uuid` to the uuid include paths so it can build the `_uuid` module. This is by default included for a bunch of extensions, but not `_uuid`. - -## `xmlrcp_client.patch` - -Fix xmlrpc.client module so it can be imported. It otherwise a call to strftime raises a ValueError that the code is not prepared to handle. diff --git a/Ports/python3/patches/define-have-sigset-t.patch b/Ports/python3/patches/define-have-sigset-t.patch index 63786569d6..86a2cbe3aa 100644 --- a/Ports/python3/patches/define-have-sigset-t.patch +++ b/Ports/python3/patches/define-have-sigset-t.patch @@ -1,5 +1,5 @@ ---- Python-3.10.0/Modules/posixmodule.h 2021-08-03 19:01:36.368000000 +0100 -+++ Python-3.10.0/Modules/posixmodule.h 2021-08-03 19:01:54.120205211 +0100 +--- Python-3.10.1/Modules/posixmodule.h 2021-08-03 19:01:36.368000000 +0100 ++++ Python-3.10.1/Modules/posixmodule.h 2021-08-03 19:01:54.120205211 +0100 @@ -19,7 +19,8 @@ #endif /* MS_WINDOWS */ diff --git a/Ports/python3/patches/define-py-force-utf8-locale.patch b/Ports/python3/patches/define-py-force-utf8-locale.patch index 9d3c3604fb..98f4ccdf2d 100644 --- a/Ports/python3/patches/define-py-force-utf8-locale.patch +++ b/Ports/python3/patches/define-py-force-utf8-locale.patch @@ -1,5 +1,5 @@ ---- Python-3.10.0/Include/pyport.h 2021-08-03 18:40:05.313000000 +0100 -+++ Python-3.10.0/Include/pyport.h 2021-08-03 18:40:28.722351782 +0100 +--- Python-3.10.1/Include/pyport.h 2021-08-03 18:40:05.313000000 +0100 ++++ Python-3.10.1/Include/pyport.h 2021-08-03 18:40:28.722351782 +0100 @@ -843,7 +843,7 @@ # error "Py_TRACE_REFS ABI is not compatible with release and debug ABI" #endif diff --git a/Ports/python3/patches/fix-autoconf.patch b/Ports/python3/patches/fix-autoconf.patch index a34db49389..370fb56cc0 100644 --- a/Ports/python3/patches/fix-autoconf.patch +++ b/Ports/python3/patches/fix-autoconf.patch @@ -1,16 +1,17 @@ ---- Python-3.10.0/config.sub 2021-08-03 19:03:07.361000000 +0100 -+++ Python-3.10.0/config.sub 2021-08-03 19:04:06.425786525 +0100 -@@ -1485,6 +1485,8 @@ - -oss*) - os=-sysv3 +--- Python-3.10.1/config.sub 2021-12-06 18:23:39.000000000 +0000 ++++ Python-3.10.1/config.sub 2021-12-11 17:17:07.076780435 +0000 +@@ -1474,6 +1474,9 @@ + oss*) + os=sysv3 ;; -+ -serenity*) ++ serenity*) ++ os=serenity + ;; - -svr4*) - os=-sysv4 + svr4*) + os=sysv4 ;; ---- Python-3.10.0/configure.ac 2021-08-03 19:04:59.784000000 +0100 -+++ Python-3.10.0/configure.ac 2021-08-03 19:08:42.069896469 +0100 +--- Python-3.10.1/configure.ac 2021-12-06 18:23:39.000000000 +0000 ++++ Python-3.10.1/configure.ac 2021-12-11 17:23:18.363664786 +0000 @@ -391,6 +391,9 @@ # a lot of different things including 'define_xopen_source' # in the case statement below. @@ -39,7 +40,7 @@ *-*-linux*) case "$host_cpu" in arm*) -@@ -2757,7 +2764,7 @@ +@@ -2802,7 +2809,7 @@ LINKFORSHARED="-Wl,-E -Wl,+s";; # LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";; Linux-android*) LINKFORSHARED="-pie -Xlinker -export-dynamic";; @@ -48,9 +49,9 @@ # -u libsys_s pulls in all symbols in libsys Darwin/*) LINKFORSHARED="$extra_undefs -framework CoreFoundation" ---- Python-3.10.0/configure 2021-09-07 15:18:28.000000000 +0200 -+++ Python-3.10.0/configure 2021-09-18 17:01:57.104963183 +0200 -@@ -3325,6 +3325,9 @@ +--- Python-3.10.1/configure 2021-12-06 18:23:39.000000000 +0000 ++++ Python-3.10.1/configure 2021-12-11 17:25:05.866475699 +0000 +@@ -3335,6 +3335,9 @@ # a lot of different things including 'define_xopen_source' # in the case statement below. case "$host" in @@ -60,7 +61,7 @@ *-*-linux-android*) ac_sys_system=Linux-android ;; -@@ -3363,6 +3366,7 @@ +@@ -3373,6 +3376,7 @@ linux*) MACHDEP="linux";; cygwin*) MACHDEP="cygwin";; darwin*) MACHDEP="darwin";; @@ -68,7 +69,7 @@ '') MACHDEP="unknown";; esac fi -@@ -3372,6 +3376,9 @@ +@@ -3382,6 +3386,9 @@ if test "$cross_compiling" = yes; then case "$host" in @@ -78,7 +79,7 @@ *-*-linux*) case "$host_cpu" in arm*) -@@ -9768,7 +9775,7 @@ +@@ -9875,7 +9882,7 @@ LINKFORSHARED="-Wl,-E -Wl,+s";; # LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";; Linux-android*) LINKFORSHARED="-pie -Xlinker -export-dynamic";; diff --git a/Ports/python3/patches/http-client.patch b/Ports/python3/patches/http-client.patch deleted file mode 100644 index baefdb8453..0000000000 --- a/Ports/python3/patches/http-client.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- Python-3.10/Lib/http/client.py 2021-09-07 21:18:28.000000000 +0800 -+++ Python-3.10/Lib/http/client.py 2021-09-30 10:22:31.513921004 +0800 -@@ -70,6 +70,7 @@ - - import email.parser - import email.message -+import errno - import http - import io - import re -@@ -939,7 +940,12 @@ - sys.audit("http.client.connect", self, self.host, self.port) - self.sock = self._create_connection( - (self.host,self.port), self.timeout, self.source_address) -- self.sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) -+ # Might fail in OSs that don't implement TCP_NODELAY -+ try: -+ self.sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) -+ except OSError as e: -+ if e.errno != errno.ENOPROTOOPT: -+ raise - - if self._tunnel_host: - self._tunnel() diff --git a/Ports/python3/patches/include-sys-uio.patch b/Ports/python3/patches/include-sys-uio.patch index 7a2d8e0c2a..64edd2c9a1 100644 --- a/Ports/python3/patches/include-sys-uio.patch +++ b/Ports/python3/patches/include-sys-uio.patch @@ -1,5 +1,5 @@ ---- Python-3.10.0/Modules/socketmodule.c 2021-09-09 01:14:41.120232921 +0800 -+++ Python-3.10.0/Modules/socketmodule.c 2021-08-03 03:53:59.000000000 +0800 +--- Python-3.10.1/Modules/socketmodule.c 2021-09-09 01:14:41.120232921 +0800 ++++ Python-3.10.1/Modules/socketmodule.c 2021-08-03 03:53:59.000000000 +0800 @@ -168,7 +168,7 @@ # undef HAVE_GETHOSTBYNAME_R_6_ARG #endif diff --git a/Ports/python3/patches/tweak-setup-py.patch b/Ports/python3/patches/tweak-setup-py.patch deleted file mode 100644 index c39c768efc..0000000000 --- a/Ports/python3/patches/tweak-setup-py.patch +++ /dev/null @@ -1,41 +0,0 @@ ---- Python-3.10.0/setup.py 2021-09-18 16:58:59.857000000 +0200 -+++ Python-3.10.0/setup.py 2021-09-18 16:59:10.448465217 +0200 -@@ -832,8 +832,8 @@ - add_dir_to_list(self.compiler.include_dirs, - sysconfig.get_config_var("INCLUDEDIR")) - -- system_lib_dirs = ['/lib64', '/usr/lib64', '/lib', '/usr/lib'] -- system_include_dirs = ['/usr/include'] -+ system_lib_dirs = ['/lib64', '/usr/lib64', '/lib', '/usr/lib', '/usr/local/lib'] -+ system_include_dirs = ['/usr/include', '/usr/local/include'] - # lib_dirs and inc_dirs are used to search for files; - # if a file is found in one of those directories, it can - # be assumed that no additional -I,-L directives are needed. -@@ -1144,7 +1144,12 @@ - # Curses support, requiring the System V version of curses, often - # provided by the ncurses library. - curses_defines = [] -- curses_includes = [] -+ if not CROSS_COMPILING: -+ curses_includes = ['/usr/local/include/ncurses'] -+ else: -+ curses_includes = sysroot_paths( -+ ('CPPFLAGS', 'CFLAGS', 'CC'), ['/usr/local/include/ncurses'] -+ ) - panel_library = 'panel' - if curses_library == 'ncursesw': - curses_defines.append(('HAVE_NCURSESW', '1')) -@@ -1849,7 +1854,12 @@ - - def detect_uuid(self): - # Build the _uuid module if possible -- uuid_incs = find_file("uuid.h", self.inc_dirs, ["/usr/include/uuid"]) -+ if not CROSS_COMPILING: -+ uuid_incs = find_file("uuid.h", self.inc_dirs, ["/usr/include/uuid", "/usr/local/include/uuid"]) -+ else: -+ uuid_incs = find_file("uuid.h", self.inc_dirs, sysroot_paths( -+ ('CPPFLAGS', 'CFLAGS', 'CC'), ["/usr/include/uuid", "/usr/local/include/uuid"] -+ )) - if uuid_incs is not None: - if self.compiler.find_library_file(self.lib_dirs, 'uuid'): - uuid_libs = ['uuid'] diff --git a/Ports/python3/patches/xmlrcp_client.patch b/Ports/python3/patches/xmlrcp_client.patch deleted file mode 100644 index 2b479d03e7..0000000000 --- a/Ports/python3/patches/xmlrcp_client.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- Python-3.10.0/Lib/xmlrpc/client.py 2021-10-06 14:28:27.231681509 +0800 -+++ Python-3.10.0/Lib/xmlrpc/client.py 2021-10-06 14:31:01.712267885 +0800 -@@ -264,16 +264,22 @@ - - # Issue #13305: different format codes across platforms - _day0 = datetime(1, 1, 1) --if _day0.strftime('%Y') == '0001': # Mac OS X -+def _try(fmt): -+ try: -+ return _day0.strftime(fmt) == '0001' -+ except ValueError: -+ return False -+if _try('%Y'): # Mac OS X - def _iso8601_format(value): - return value.strftime("%Y%m%dT%H:%M:%S") --elif _day0.strftime('%4Y') == '0001': # Linux -+elif _try('%4Y'): # Linux - def _iso8601_format(value): - return value.strftime("%4Y%m%dT%H:%M:%S") - else: - def _iso8601_format(value): - return value.strftime("%Y%m%dT%H:%M:%S").zfill(17) - del _day0 -+del _try - - - def _strftime(value): diff --git a/Ports/python3/version.sh b/Ports/python3/version.sh index 5a6af26cf3..9c9c2be02f 100644 --- a/Ports/python3/version.sh +++ b/Ports/python3/version.sh @@ -1,5 +1,5 @@ -PYTHON_VERSION="3.10.0" -PYTHON_VERSION_WITHOUT_SUFFIX="3.10.0" # PYTHON_VERSION but without the a1/b1/rc1/... suffix +PYTHON_VERSION="3.10.1" +PYTHON_VERSION_WITHOUT_SUFFIX="3.10.1" # PYTHON_VERSION but without the a1/b1/rc1/... suffix PYTHON_ARCHIVE="Python-${PYTHON_VERSION}.tar.xz" PYTHON_ARCHIVE_URL="https://www.python.org/ftp/python/${PYTHON_VERSION_WITHOUT_SUFFIX}/${PYTHON_ARCHIVE}" -PYTHON_ARCHIVE_SHA256SUM="5a99f8e7a6a11a7b98b4e75e0d1303d3832cada5534068f69c7b6222a7b1b002" +PYTHON_ARCHIVE_SHA256SUM="a7f1265b6e1a5de1ec5c3ec7019ab53413469934758311e9d240c46e5ae6e177"