pypy3: bump to 7.3.17 (#21297)

This commit is contained in:
termux-pacman-bot
2025-07-27 15:04:44 +00:00
parent 1889395e39
commit eb039db58c
8 changed files with 146 additions and 122 deletions

View File

@@ -155,7 +155,7 @@
--- a/rpython/rlib/rvmprof/cintf.py
+++ b/rpython/rlib/rvmprof/cintf.py
@@ -16,14 +16,14 @@
@@ -18,16 +18,16 @@
class VMProfPlatformUnsupported(Exception):
pass
@@ -165,19 +165,22 @@
-if sys.platform in ('darwin', 'linux', 'linux2') or sys.platform.startswith('freebsd'):
- try:
- proc = detect_cpu.autodetect()
- IS_SUPPORTED = proc.startswith('x86') or proc == 'aarch64'
- IS_SUPPORTED = (proc.startswith('x86')
- or proc == 'aarch64'
- or proc == 'riscv64')
- except detect_cpu.ProcessorAutodetectError:
- print("PROCESSOR NOT DETECTED, SKIPPING VMPROF")
+# if sys.platform in ('darwin', 'linux', 'linux2') or sys.platform.startswith('freebsd'):
+# try:
+# proc = detect_cpu.autodetect()
+# IS_SUPPORTED = proc.startswith('x86') or proc == 'aarch64'
+# IS_SUPPORTED = (proc.startswith('x86')
+# or proc == 'aarch64'
+# or proc == 'riscv64')
+# except detect_cpu.ProcessorAutodetectError:
+# print("PROCESSOR NOT DETECTED, SKIPPING VMPROF")
ROOT = py.path.local(rpythonroot).join('rpython', 'rlib', 'rvmprof')
SRC = ROOT.join('src')
--- a/pypy/module/posix/moduledef.py
+++ b/pypy/module/posix/moduledef.py
@@ -140,12 +140,12 @@

View File

@@ -0,0 +1,82 @@
--- a/lib_pypy/_posixshmem_build.py
+++ b/lib_pypy/_posixshmem_build.py
@@ -12,15 +12,75 @@
""")
SOURCE = """
-#include <sys/mman.h>
-#include <sys/stat.h> /* For mode constants */
-#include <fcntl.h> /* For O_* constants */
+#include <alloca.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+static int shm_unlink(const char *name) {
+ size_t namelen;
+ char *fname;
+
+ /* Construct the filename. */
+ while (name[0] == '/') ++name;
+
+ if (name[0] == '\0') {
+ /* The name "/" is not supported. */
+ errno = EINVAL;
+ return -1;
+ }
+
+ namelen = strlen(name);
+ fname = (char *) alloca(sizeof("@TERMUX_PREFIX@/tmp/") - 1 + namelen + 1);
+ memcpy(fname, "@TERMUX_PREFIX@/tmp/", sizeof("@TERMUX_PREFIX@/tmp/") - 1);
+ memcpy(fname + sizeof("@TERMUX_PREFIX@/tmp/") - 1, name, namelen + 1);
+
+ return unlink(fname);
+}
+
+static int shm_open(const char *name, int oflag, mode_t mode) {
+ size_t namelen;
+ char *fname;
+ int fd;
+
+ /* Construct the filename. */
+ while (name[0] == '/') ++name;
+
+ if (name[0] == '\0') {
+ /* The name "/" is not supported. */
+ errno = EINVAL;
+ return -1;
+ }
+
+ namelen = strlen(name);
+ fname = (char *) alloca(sizeof("@TERMUX_PREFIX@/tmp/") - 1 + namelen + 1);
+ memcpy(fname, "@TERMUX_PREFIX@/tmp/", sizeof("@TERMUX_PREFIX@/tmp/") - 1);
+ memcpy(fname + sizeof("@TERMUX_PREFIX@/tmp/") - 1, name, namelen + 1);
+
+ fd = open(fname, oflag, mode);
+ if (fd != -1) {
+ /* We got a descriptor. Now set the FD_CLOEXEC bit. */
+ int flags = fcntl(fd, F_GETFD, 0);
+ flags |= FD_CLOEXEC;
+ flags = fcntl(fd, F_SETFD, flags);
+
+ if (flags == -1) {
+ /* Something went wrong. We cannot return the descriptor. */
+ int save_errno = errno;
+ close(fd);
+ fd = -1;
+ errno = save_errno;
+ }
+ }
+
+ return fd;
+}
"""
if sys.platform == 'darwin':
libraries = []
else:
- libraries=['rt']
+ libraries=['c']
_ffi.set_source("_posixshmem_cffi", SOURCE, libraries=libraries)

View File

@@ -1,10 +0,0 @@
--- a/lib_pypy/_sqlite3_build.py
+++ b/lib_pypy/_sqlite3_build.py
@@ -229,6 +229,7 @@
def _has_load_extension():
"""Only available since 3.3.6"""
+ return True
unverified_ffi = _FFI()
unverified_ffi.cdef("""
typedef ... sqlite3;

View File

@@ -1,95 +0,0 @@
--- a/lib_pypy/_posixshmem_build.py
+++ b/lib_pypy/_posixshmem_build.py
@@ -12,15 +12,88 @@
""")
SOURCE = """
-#include <sys/mman.h>
-#include <sys/stat.h> /* For mode constants */
-#include <fcntl.h> /* For O_* constants */
+/* This file is a port of posix shared memory for Python3 on Termux Android,
+ based on musl-libc which is licensed under the following standard MIT
+ license. The ported files are listed as following.
+
+ File(s): src/mman/shm_open.c
+
+ Copyright © 2005-2020 Rich Felker, et al.
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include <fcntl.h> // open()
+#include <string.h> // strlen(), memcpy()
+#include <errno.h> // errno
+#include <limits.h> // NAME_MAX
+#include <unistd.h> // unlink()
+
+#define SHM_PREFIX "@TERMUX_PREFIX@/tmp/shm."
+
+static __inline__ char *__strchrnul(const char *s, int c)
+{
+ c = (unsigned char)c;
+ if (!c) return (char *)s + strlen(s);
+ for (; *s && *(unsigned char *)s != c; s++);
+ return (char *)s;
+}
+
+static char *__shm_mapname(const char *name, char *buf)
+{
+ char *p;
+ while (*name == '/') name++;
+ if (*(p = __strchrnul(name, '/')) || p==name ||
+ (p-name <= 2 && name[0]=='.' && p[-1]=='.')) {
+ errno = EINVAL;
+ return 0;
+ }
+ if (p-name > NAME_MAX-4) {
+ errno = ENAMETOOLONG;
+ return 0;
+ }
+ memcpy(buf, SHM_PREFIX, strlen(SHM_PREFIX));
+ memcpy(buf+strlen(SHM_PREFIX), name, p-name+1);
+ return buf;
+}
+
+int shm_open(const char *name, int flag, mode_t mode)
+{
+ char buf[NAME_MAX+strlen(SHM_PREFIX)+1];
+ if (!(name = __shm_mapname(name, buf))) return -1;
+ int fd = open(name, flag|O_NOFOLLOW|O_CLOEXEC|O_NONBLOCK, mode);
+ return fd;
+}
+
+int shm_unlink(const char *name)
+{
+ char buf[NAME_MAX+strlen(SHM_PREFIX)+1];
+ if (!(name = __shm_mapname(name, buf))) return -1;
+ return unlink(name);
+}
"""
if sys.platform == 'darwin':
libraries = []
else:
- libraries=['rt']
+ libraries=['c']
_ffi.set_source("_posixshmem_cffi", SOURCE, libraries=libraries)

View File

@@ -0,0 +1,11 @@
--- a/rpython/memory/gc/env.py
+++ b/rpython/memory/gc/env.py
@@ -140,7 +140,7 @@
return get_L2cache_linux2_cpuinfo(label='L2 cache')
#if arch == 's390x': untested
# return get_L2cache_linux2_cpuinfo_s390x()
- if arch in ('ia64', 'aarch64'):
+ if arch in ('ia64'):
return get_L2cache_linux2_system_cpu_index()
if arch in ('parisc', 'parisc64'):
return get_L2cache_linux2_cpuinfo(label='D-cache')

View File

@@ -0,0 +1,26 @@
--- a/lib_pypy/_sqlite3_build.py
+++ b/lib_pypy/_sqlite3_build.py
@@ -248,6 +248,7 @@
def _has_load_extension():
"""Only available since 3.3.6"""
+ return @SQLITE_HAS_LOAD_EXTENSION@
unverified_ffi = _FFI()
unverified_ffi.cdef("""
typedef ... sqlite3;
@@ -264,6 +265,7 @@
def _has_backup():
"""Only available since 3.6.11"""
+ return @SQLITE_HAS_BACKUP@
unverified_ffi = _FFI()
unverified_ffi.cdef("""
typedef ... sqlite3;
@@ -280,6 +282,7 @@
return hasattr(unverified_lib, 'sqlite3_backup_init')
def _get_version():
+ return @SQLITE_VERSION_NUMBER@
unverified_ffi = _FFI()
unverified_ffi.cdef("""
int sqlite3_libversion_number(void);

View File

@@ -2,19 +2,32 @@ TERMUX_PKG_HOMEPAGE=https://pypy.org
TERMUX_PKG_DESCRIPTION="A fast, compliant alternative implementation of Python 3"
TERMUX_PKG_LICENSE="MIT"
TERMUX_PKG_MAINTAINER="@licy183"
_MAJOR_VERSION=3.9
TERMUX_PKG_VERSION=7.3.15
TERMUX_PKG_REVISION=4
_MAJOR_VERSION=3.10
TERMUX_PKG_VERSION=7.3.17
TERMUX_PKG_SRCURL=https://downloads.python.org/pypy/pypy$_MAJOR_VERSION-v$TERMUX_PKG_VERSION-src.tar.bz2
TERMUX_PKG_SHA256=6bb9537d85aa7ad13c0aad2e41ff7fd55080bc9b4d1361b8f502df51db816e18
TERMUX_PKG_SHA256=6ad74bc578e9c6d3a8a1c51503313058e3c58c35df86f7485453c4be6ab24bf7
TERMUX_PKG_DEPENDS="gdbm, libandroid-posix-semaphore, libandroid-support, libbz2, libcrypt, libexpat, libffi, liblzma, libsqlite, ncurses, ncurses-ui-libs, openssl, zlib"
TERMUX_PKG_BUILD_DEPENDS="aosp-libs, coreutils, clang, make, pkg-config, python2, tk, xorgproto"
TERMUX_PKG_RECOMMENDS="clang, make, pkg-config"
TERMUX_PKG_SUGGESTS="pypy3-tkinter"
TERMUX_PKG_BUILD_IN_SRC=true
TERMUX_PKG_ON_DEVICE_BUILD_NOT_SUPPORTED=true
termux_step_post_get_source() {
local p="$TERMUX_PKG_BUILDER_DIR/9998-link-against-pypy3-on-testcapi.diff"
local sqlite_version=$(. $TERMUX_SCRIPTDIR/packages/libsqlite/build.sh; echo $TERMUX_PKG_VERSION)
local sqlite_version_X=$(cut -d"." -f1 <<< "$sqlite_version")
local sqlite_version_Y=$(cut -d"." -f2 <<< "$sqlite_version")
local sqlite_version_Z=$(cut -d"." -f3 <<< "$sqlite_version")
local SQLITE_VERSION_NUMBER=$(bc <<< "($sqlite_version_X) * 1000000 + ($sqlite_version_Y) * 1000 + ($sqlite_version_Z)")
local p="$TERMUX_PKG_BUILDER_DIR/9997-do-not-cffi-dlopen-when-compiling-sqlite3.diff"
echo "Applying $(basename "${p}")"
sed \
's|@SQLITE_HAS_LOAD_EXTENSION@|True|g
s|@SQLITE_HAS_BACKUP@|True|g
s|@SQLITE_VERSION_NUMBER@|'"${SQLITE_VERSION_NUMBER}"'|g' \
"${p}" | patch --silent -p1
p="$TERMUX_PKG_BUILDER_DIR/9998-link-against-pypy3-on-testcapi.diff"
echo "Applying $(basename "${p}")"
sed 's|@TERMUX_PYPY_MAJOR_VERSION@|'"${_MAJOR_VERSION}"'|g' "${p}" \
| patch --silent -p1
@@ -29,12 +42,6 @@ termux_step_post_get_source() {
"$TERMUX_PKG_SRCDIR"/rpython/translator/platform/termux.py
}
termux_step_pre_configure() {
if $TERMUX_ON_DEVICE_BUILD; then
termux_error_exit "Package '$TERMUX_PKG_NAME' is not safe for on-device builds."
fi
}
__setup_proot() {
mkdir -p "$TERMUX_PKG_CACHEDIR"/proot-bin
termux_download \
@@ -297,7 +304,7 @@ termux_step_make() {
--archive-name=pypy$_MAJOR_VERSION-v$TERMUX_PKG_VERSION \
--targetdir=$TERMUX_PKG_SRCDIR \
--no-embedded-dependencies \
--no-keep-debug || bash
--no-keep-debug
rm -f "$TERMUX_PREFIX"/lib/libpypy$_MAJOR_VERSION-c.so
}
@@ -315,7 +322,7 @@ termux_step_create_debscripts() {
cat <<- PRERM_EOF > ./prerm
#!$TERMUX_PREFIX/bin/sh
if [ "$TERMUX_PACKAGE_FORMAT" != "pacman" ] && [ "\$1" != "remove" ]; then
if [ "$TERMUX_PACKAGE_FORMAT" = "debian" ] && [ "\$1" != "remove" ]; then
exit 0
fi