summaryrefslogtreecommitdiff
path: root/Ports/python3/patches/define-py-force-utf8-locale.patch
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2021-01-18 20:26:26 +0100
committerAndreas Kling <kling@serenityos.org>2021-01-18 22:28:56 +0100
commit39af1f8519d4a33a90ae79e5b3277652aac85270 (patch)
treea6243fb69b1c10c580e97514d44ad0dd08f83b7a /Ports/python3/patches/define-py-force-utf8-locale.patch
parentc46056122a49aa5789c44aca9567e729d175cbbe (diff)
downloadserenity-39af1f8519d4a33a90ae79e5b3277652aac85270.zip
Ports: Add Python 3.9
The current version of our Python port (3.6.0) is over four years old by now and has (or had, I haven't actually tried it in a while) some limitations - time for an upgrade! The latest Python release is 3.9.1, so I used that version. It's a from-scratch port, no patches are taken from the previous port to ensure the smallest possible amount of code is patched. The BuildPython.sh script is useful so I kept it, with some tweaks. I added a short document explaining each patch to ease judging their underlying problem and necessity in the future. Compared to the old Python port, this one does support both the time module as well as threading (at least _thread) just fine. Importing modules written in C (everything in /usr/local/lib/python3.9/lib-dynload) currently asserts in Serenity's dynamic loader, which is unfortunate but probably solvable. Possibly related to #4642. I didn't try building Python statically, which might be one possibility to circumvent this issue. I also renamed the directory to just "python3", which is analogous to the Python 3.x package most Linux distributions provide. That implicitly means that we likely will not support multiple versions of the Python port at any given time, but again, neither do many other systems by default. Recent versions are usually backwards compatible anyway though, so having the latest shouldn't be a problem. On the other hand bumping the version should now be be as simple as updating the variables in version.sh, given that no new patches are required. These core modules to currently not build - I chose to ignore that for now rather than adding more patches to make them work somehow, which means they're fully unavailable. This should probably be fixed in Serenity itself. _ctypes, _decimal, _socket, mmap, resource, termios These optional modules requiring 3rd-party dependencies do currently not build (even with depends="ncurses openssl zlib"). Especially the absence of a readline port makes the REPL a bit painful to use. :^) _bz2, _curses, _curses_panel, _dbm, _gdbm, _hashlib, _lzma, _sqlite3, _ssl, _tkinter, _uuid, nis, ossaudiodev, readline, spwd, zlib I did some work on LibC and LibM beforehand to add at least stubs of missing required functions, it still encounters an ASSERT_NOT_REACHED() / TODO() every now and then, notably frexp() (implementations of that can be found online easily if you want to get that working right now). But then again that's our fault and not this port's. :^)
Diffstat (limited to 'Ports/python3/patches/define-py-force-utf8-locale.patch')
-rw-r--r--Ports/python3/patches/define-py-force-utf8-locale.patch11
1 files changed, 11 insertions, 0 deletions
diff --git a/Ports/python3/patches/define-py-force-utf8-locale.patch b/Ports/python3/patches/define-py-force-utf8-locale.patch
new file mode 100644
index 0000000000..d8e6ea1b4b
--- /dev/null
+++ b/Ports/python3/patches/define-py-force-utf8-locale.patch
@@ -0,0 +1,11 @@
+--- Python-3.9.1/Include/pyport.h 2021-01-17 20:45:44.417000000 +0100
++++ Python-3.9.1/Include/pyport.h 2021-01-17 20:46:07.865663659 +0100
+@@ -838,7 +838,7 @@
+ # error "Py_TRACE_REFS ABI is not compatible with release and debug ABI"
+ #endif
+
+-#if defined(__ANDROID__) || defined(__VXWORKS__)
++#if defined(__ANDROID__) || defined(__VXWORKS__) || defined(__serenity__)
+ /* Ignore the locale encoding: force UTF-8 */
+ # define _Py_FORCE_UTF8_LOCALE
+ #endif