Ports: Update Python to 3.12.0

Released on 2023-10-02.
https://www.python.org/downloads/release/python-3120/

Note that the top-level setup.py script has disappeared completely,
hence the two dropped patches. AFAICT this doesn't regress building any
of the native modules, presumably because the configure script fully
takes care of this now:

```
The necessary bits to build these optional modules were not found:
_dbm                  _gdbm                 _posixshmem
_tkinter              nis                   ossaudiodev
To find the necessary bits, look in configure.ac and config.log.

Checked 111 modules (31 built-in, 73 shared, 1 n/a on serenityos-x86_64,
0 disabled, 6 missing, 0 failed on import)
```
This commit is contained in:
Linus Groh 2023-10-02 21:04:53 +01:00 committed by Tim Schumacher
parent e7f33cef1e
commit 006bf1905b
9 changed files with 23 additions and 131 deletions

View file

@ -261,7 +261,7 @@ This list is also available at [ports.serenityos.net](https://ports.serenityos.n
| [`protobuf`](protobuf/) | Protocol Buffers | 24.3 | https://protobuf.dev/ |
| [`pt2-clone`](pt2-clone/) | ProTracker 2 clone | 1.49 | https://github.com/8bitbubsy/pt2-clone |
| [`pv`](pv/) | Pipe Viewer | 1.6.20 | http://www.ivarch.com/programs/pv.shtml |
| [`python3`](python3/) | Python | 3.11.5 | https://www.python.org/ |
| [`python3`](python3/) | Python | 3.12.0 | https://www.python.org/ |
| [`qemu`](qemu/) | QEMU | 8.1.0 | https://qemu.org |
| [`qoi`](qoi/) | Quite OK Image Format for fast, lossless image compression | edb8d7b | https://github.com/phoboslab/qoi |
| [`qt6-qt5compat`](qt6-qt5compat/) | Qt6 Qt5Compat | 6.4.0 | https://doc.qt.io/qt-6/qtcore5-index.html |

View file

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Linus Groh <mail@linusgroh.de>
Date: Fri, 14 Jan 2022 23:35:20 +0330
Date: Mon, 2 Oct 2023 18:49:19 +0100
Subject: [PATCH] Enforce UTF-8 as the locale encoding
By defining `_Py_FORCE_UTF8_LOCALE` as some other platforms already do,
@ -10,10 +10,10 @@ we can enforce UTF-8 as the encoding.
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Include/pyport.h b/Include/pyport.h
index 93250f4eb1d7a23ec05a312f97cae4236b64dc7c..33d1ca5f1d21751ca90670eabdc848ad68a12ef1 100644
index 35eca7234ca0949fa552e05c60f9e33d8eb36d1d..d8c01355af15dc0abd6fa588e892603d0bf55fd5 100644
--- a/Include/pyport.h
+++ b/Include/pyport.h
@@ -678,7 +678,7 @@ extern char * _getpty(int *, int, mode_t, int);
@@ -684,7 +684,7 @@ extern char * _getpty(int *, int, mode_t, int);
# error "Py_TRACE_REFS ABI is not compatible with release and debug ABI"
#endif

View file

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Linus Groh <mail@linusgroh.de>
Date: Fri, 14 Jan 2022 23:35:57 +0330
Date: Mon, 2 Oct 2023 18:52:35 +0100
Subject: [PATCH] Tweak configure
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
@ -17,10 +17,10 @@ Co-Authored-By: Oskar Skog <oskar@oskog97.com>
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/configure b/configure
index af4a5bbfdfa1a4cc8069f67f4e4fe20a35fd27ee..8a043f76112625ffe425c3a69420191abe382f54 100755
index b6f90bcd8c7300cbbe0e2a653c9f39e605e8507f..d05ebfcde44a5159036f4597cfd43553f1da404f 100755
--- a/configure
+++ b/configure
@@ -3814,6 +3814,9 @@ then
@@ -4258,6 +4258,9 @@ then
# a lot of different things including 'define_xopen_source'
# in the case statement below.
case "$host" in
@ -30,7 +30,7 @@ index af4a5bbfdfa1a4cc8069f67f4e4fe20a35fd27ee..8a043f76112625ffe425c3a69420191a
*-*-linux-android*)
ac_sys_system=Linux-android
;;
@@ -3858,6 +3861,7 @@ then
@@ -4302,6 +4305,7 @@ then
linux*) MACHDEP="linux";;
cygwin*) MACHDEP="cygwin";;
darwin*) MACHDEP="darwin";;
@ -38,7 +38,7 @@ index af4a5bbfdfa1a4cc8069f67f4e4fe20a35fd27ee..8a043f76112625ffe425c3a69420191a
'') MACHDEP="unknown";;
esac
fi
@@ -3867,6 +3871,9 @@ $as_echo "\"$MACHDEP\"" >&6; }
@@ -4311,6 +4315,9 @@ printf "%s\n" "\"$MACHDEP\"" >&6; }
if test "$cross_compiling" = yes; then
case "$host" in
@ -48,7 +48,7 @@ index af4a5bbfdfa1a4cc8069f67f4e4fe20a35fd27ee..8a043f76112625ffe425c3a69420191a
*-*-linux*)
case "$host_cpu" in
arm*)
@@ -6743,7 +6750,7 @@ $as_echo "#define Py_ENABLE_SHARED 1" >>confdefs.h
@@ -7488,7 +7495,7 @@ printf "%s\n" "#define Py_ENABLE_SHARED 1" >>confdefs.h
PY3LIBRARY=libpython3.so
fi
;;
@ -57,16 +57,16 @@ index af4a5bbfdfa1a4cc8069f67f4e4fe20a35fd27ee..8a043f76112625ffe425c3a69420191a
LDLIBRARY='libpython$(LDVERSION).so'
BLDLIBRARY='-L. -lpython$(LDVERSION)'
RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
@@ -11028,7 +11035,7 @@ then
@@ -12839,7 +12846,7 @@ then
else CCSHARED="+z";
fi;;
Linux-android*) ;;
- Linux*|GNU*) CCSHARED="-fPIC";;
+ Linux*|GNU*|SerenityOS*) CCSHARED="-fPIC";;
Emscripten*|WASI*)
if test "x$enable_wasm_dynamic_linking" = xyes; then :
@@ -11065,7 +11072,7 @@ then
if test "x$enable_wasm_dynamic_linking" = xyes
then :
@@ -12877,7 +12884,7 @@ then
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,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Linus Groh <mail@linusgroh.de>
Date: Fri, 14 Jan 2022 23:36:28 +0330
Date: Mon, 2 Oct 2023 18:52:48 +0100
Subject: [PATCH] Include `sys/uio.h` in `socketmodule.c`
This is to ensure that `struct iovec` is defined, which is required by
@ -10,10 +10,10 @@ the `socket` module.
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index e6d983afa7da85622c0f0e2032e0cb41adc337a2..e29c4b432aed97a99311fe37d8c4b16be3eb4962 100644
index 4ec68e22a9f8cd74fc027beb8a895c0b7f2b2f82..9fa20cd95b41bea51ae9ccadc24ec74bf222b695 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -175,7 +175,7 @@ shutdown(how) -- shut down traffic in one or both directions\n\
@@ -176,7 +176,7 @@ shutdown(how) -- shut down traffic in one or both directions\n\
# undef HAVE_GETHOSTBYNAME_R_6_ARG
#endif

View file

@ -1,47 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Linus Groh <mail@linusgroh.de>
Date: Fri, 14 Jan 2022 23:36:52 +0330
Subject: [PATCH] Tweak `setup.py`
Make some tweaks to Python's `setup.py`:
- Add `/usr/local/lib` and `/usr/local/include` to the system lib and
include dirs respectively, 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`.
---
setup.py | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/setup.py b/setup.py
index 4f122b62e0e708fa4feff0ae94cf9949805b35d2..382950a814c06bda1b9a2dc4bb7ade39f16823ca 100644
--- a/setup.py
+++ b/setup.py
@@ -868,8 +868,8 @@ class PyBuildExt(build_ext):
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.
@@ -1120,7 +1120,12 @@ class PyBuildExt(build_ext):
# 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'))

View file

@ -12,10 +12,10 @@ For now, it can be safely ignored until it's supported in the kernel.
1 file changed, 2 insertions(+)
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index e29c4b432aed97a99311fe37d8c4b16be3eb4962..bcd6233ad6a5f11a34b515630dbadf14ab43854d 100644
index 9fa20cd95b41bea51ae9ccadc24ec74bf222b695..76160293f9d831b8516d0094bd3ea4039c059eca 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -3045,6 +3045,8 @@ sock_setsockopt(PySocketSockObject *s, PyObject *args)
@@ -3209,6 +3209,8 @@ sock_setsockopt(PySocketSockObject *s, PyObject *args)
PyBuffer_Release(&optval);
done:

View file

@ -1,29 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Humberto Alves <hjalves@live.com>
Date: Thu, 1 Sep 2022 20:25:11 +0100
Subject: [PATCH] Tweak `setup.py` sysroot detection
When crosscompiling, the Python installer expects the C compiler to
be invoked with a `--sysroot` command line option, which then is used
to find additional subdirectories containing headers and libraries.
Because there is no such option present, this is a workaround to use
the environment variable `SERENITY_INSTALL_ROOT` as a fake `--sysroot`
in the detection code.
---
setup.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/setup.py b/setup.py
index 382950a814c06bda1b9a2dc4bb7ade39f16823ca..ceac9cbdad9f9a7bc1fd1ee5d4626e3ff0728c3d 100644
--- a/setup.py
+++ b/setup.py
@@ -166,6 +166,8 @@ def sysroot_paths(make_vars, subdirs):
for var_name in make_vars:
var = sysconfig.get_config_var(var_name)
if var is not None:
+ if serenity_install_root := os.environ.get('SERENITY_INSTALL_ROOT'):
+ var += f' --sysroot={serenity_install_root}'
m = re.search(r'--sysroot=([^"]\S*|"[^"]+")', var)
if m is not None:
sysroot = m.group(1).strip('"')

View file

@ -11,16 +11,10 @@ we can enforce UTF-8 as the encoding.
Tweak configure
Merged patches from Linus Groh, Julian Offenhäuser, Oskar Skog:
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.
Set name of shared libpython
Compile with CCSHARED=-fPIC
## `0003-Include-sys-uio.h-in-socketmodule.c.patch`
Include `sys/uio.h` in `socketmodule.c`
@ -28,33 +22,7 @@ Include `sys/uio.h` in `socketmodule.c`
This is to ensure that `struct iovec` is defined, which is required by
the `socket` module.
## `0004-Tweak-setup.py.patch`
Tweak `setup.py`
Make some tweaks to Python's `setup.py`:
- Add `/usr/local/lib` and `/usr/local/include` to the system lib and
include dirs respectively, 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`.
## `0005-Tweak-setup.py-sysroot-detection.patch`
Tweak `setup.py` sysroot detection
When crosscompiling, the Python installer expects the C compiler to
be invoked with a `--sysroot` command line option, which then is used
to find additional subdirectories containing headers and libraries.
Because there is no such option present, this is a workaround to use
the environment variable `SERENITY_INSTALL_ROOT` as a fake `--sysroot`
in the detection code.
## `0006-Workaround-for-unsupported-socket-option.patch`
## `0004-Workaround-for-unsupported-socket-option.patch`
Workaround for unsupported socket option

View file

@ -1,5 +1,5 @@
PYTHON_VERSION="3.11.5"
PYTHON_VERSION_WITHOUT_SUFFIX="3.11.5" # PYTHON_VERSION but without the a1/b1/rc1/... suffix
PYTHON_VERSION="3.12.0"
PYTHON_VERSION_WITHOUT_SUFFIX="3.12.0" # 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="85cd12e9cf1d6d5a45f17f7afe1cebe7ee628d3282281c492e86adf636defa3f"
PYTHON_ARCHIVE_SHA256SUM="795c34f44df45a0e9b9710c8c71c15c671871524cd412ca14def212e8ccb155d"