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! :^)
This commit is contained in:
Linus Groh 2021-12-11 17:43:42 +00:00
parent 1e95e7716b
commit 6d9a1d3c93
Notes: sideshowbarker 2024-07-17 22:59:08 +09:00
10 changed files with 28 additions and 135 deletions

View file

@ -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 |

View file

@ -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.

View file

@ -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 */

View file

@ -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

View file

@ -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";;

View file

@ -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()

View file

@ -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

View file

@ -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']

View file

@ -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):

View file

@ -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"