Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3.13 bringup #3759

Merged
merged 4 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build/meta/illumos-tools.p5m
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ depend fmri=system/header type=require
depend fmri=system/management/snmp/net-snmp type=require
depend fmri=text/gnu-gettext type=require
depend fmri=runtime/python-312 type=require
depend fmri=runtime/python-313 type=require
4 changes: 1 addition & 3 deletions build/python312/local.mog
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ license LICENSE license=PSFv2

<transform link mediator=python3 -> set mediator-version $(PYTHONVER)>

# Let the default mediator priority take effect while the highest version is
# the default.
#<transform link mediator=python3 -> set mediator-priority vendor>
<transform link mediator=python3 -> set mediator-priority vendor>

# Add mediated link for /usr/bin/python and python-config
link path=usr/bin/python target=python3
Expand Down
60 changes: 60 additions & 0 deletions build/python313/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@

Python module dependencies
--------------------------

setuptools
pip (and pip depends on setuptools! See "Bootstrap" below)

pkg
cryptography
setuptools-rust
semantic-version
typing-extensions
tomli
six
cffi
pycparser
asn1crypto
idna
jsonrpclib
jsonschema
attrs
pyrsistent
js-regex
orjson
pycurl
rapidjson
coverage
pyopenssl
cryptography

bhyve (brand)
pyyaml

glib2
meson
packaging


Bootstrap
---------

To bootstrap modules for a new python version, build 'setuptools' and 'pip'
with the '-f bootstrap' flag, and install these bootstrap packages:

for m in setuptools pip; do
{ cd $m; ./build.sh -f bootstrap -blt; }
done
pfexec pkg install {pip,setuptools}-3XX-bootstrap

then build again, without the bootstrap flag:

for m in setuptools pip; do
{ cd $m; ./build.sh -blt; }
done

and finally switch out the bootstrap packages for the real ones:

pfexec pkg install --reject pip-3XX-bootstrap pip-3XX
pfexec pkg install --reject setuptools-3XX-bootstrap setuptools-3XX

38 changes: 38 additions & 0 deletions build/python313/asn1crypto/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/bash
#
# {{{ CDDL HEADER
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
# }}}
#
# Copyright 2024 OmniOS Community Edition (OmniOSce) Association.

. ../../../lib/build.sh

PKG=library/python-3/asn1crypto-313
PROG=asn1crypto
inherit_ver python312/asn1crypto
SUMMARY="asn1crypto - Fast ASN.1 parser..."
DESC="$SUMMARY"

. $SRCDIR/../common.sh

BUILD_DEPENDS_IPS+="library/python-$PYMVER/setuptools-$SPYVER"

init
download_source pymodules/$PROG $PROG $VER
patch_source
prep_build
python_build
make_package
clean_up

# Vim hints
# vim:ts=4:sw=4:et:fdm=marker
14 changes: 14 additions & 0 deletions build/python313/asn1crypto/local.mog
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.

# Copyright 2019 OmniOS Community Edition (OmniOSce) Association.

license LICENSE license=MIT

36 changes: 36 additions & 0 deletions build/python313/attrs/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/bash
#
# {{{ CDDL HEADER
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
# }}}
#
# Copyright 2024 OmniOS Community Edition (OmniOSce) Association.
#
. ../../../lib/build.sh

PKG=library/python-3/attrs-313
PROG=attrs
inherit_ver python312/attrs
SUMMARY="Python attrs"
DESC="Classes Without Boilerplate"

. $SRCDIR/../common.sh

init
download_source pymodules/$PROG $PROG $VER
patch_source
prep_build
python_build
make_package
clean_up

# Vim hints
# vim:ts=4:sw=4:et:fdm=marker
18 changes: 18 additions & 0 deletions build/python313/attrs/local.mog
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#

# Copyright 2019 OmniOS Community Edition (OmniOSce) Association.

license LICENSE license=MIT

<transform file path=usr/bin \
-> edit path usr/bin usr/lib/python$(PYTHONVER)/bin>

202 changes: 202 additions & 0 deletions build/python313/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
#!/usr/bin/bash
#
# {{{ CDDL HEADER
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
# }}}
#
# Copyright 2024 OmniOS Community Edition (OmniOSce) Association.
#
. ../../lib/build.sh

PROG=Python
VER=3.13.1
PKG=runtime/python-313
MVER=${VER%.*}
SUMMARY="$PROG $MVER"
DESC="$SUMMARY"

BUILD_DEPENDS_IPS="
developer/build/autoconf
developer/pkg-config
ooce/developer/autoconf-archive
"
RUN_DEPENDS_IPS="
compress/bzip2
database/sqlite-3
library/expat
library/libffi
library/libxml2
library/ncurses
library/readline
library/security/openssl-3
library/zlib
system/library/gcc-runtime
developer/object-file
"
XFORM_ARGS="-D PYTHONVER=$MVER"

HARDLINK_TARGETS="
usr/bin/python$MVER
"
SKIP_RTIME_CHECK=1
NO_SONAME_EXPECTED=1

set_python_version $MVER
set_arch 64

# To expose the CMSG_ macros and new recvmsg() semantics for the socket module
set_standard XPG6

# Save arguments to the stack so that the mdb/pstack plugin can find them.
CFLAGS[amd64]+=" -msave-args"
CFLAGS[aarch64]+=" -mtls-dialect=trad"

export CCSHARED="-fPIC"
CPPFLAGS+=" -I/usr/include/ncurses"
export DFLAGS=-64
MAKE_ARGS="
DFLAGS=-64
DESTSHARED=/usr/lib/python$MVER/lib-dynload
"
MAKE_INSTALL_ARGS=DESTSHARED=/usr/lib/python$MVER/lib-dynload

CONFIGURE_OPTS="
--enable-shared
--with-system-expat
--enable-ipv6
--without-ensurepip
"

CONFIGURE_OPTS[amd64]+="
--enable-optimizations
--with-dtrace
"

CONFIGURE_OPTS[aarch64]+="
--build=${TRIPLETS[amd64]%.*}
--with-build-python=$PYTHON
ac_cv_file__dev_ptmx=yes
ac_cv_file__dev_ptc=no
"

# See https://bugs.python.org/issue25003
# There is (was?) a bug in Python which massively slowed down os.urandom()
# due to the introduction of a call to getentropy() which blocks until there
# is sufficient entropy, and this affected pkg(7) significantly.
# We tell Python that we don't have getentropy(); Solaris does the same.
CONFIGURE_OPTS+=" ac_cv_func_getentropy=no "

# hstrerror() is present in -lresolv, but if configure decides it's available
# then it uses it in a number of modules, which then don't link.
# Versions of Python < 3.11 did not detect this function but the new checks
# in 3.11 are less robust and think it's there even when it isn't.
# https://github.com/python/cpython/issues/89886#issuecomment-1106100113
CONFIGURE_OPTS+=" ac_cv_func_hstrerror=no"

# XXX
CONFIGURE_OPTS+=" ac_cv_readline_rl_startup_hook_takes_args=no"

export DTRACE_CPP=$GCCPATH/bin/cpp

CURSES_CFLAGS="-DHAVE_NCURSESW -D_XOPEN_SOURCE_EXTENDED"
LIBREADLINE_LIBS="-zrecord -lreadline -lncurses"
export CURSES_CFLAGS LIBREADLINE_LIBS

build_init() {
typeset s=${SYSROOT[aarch64]}

addpath PKG_CONFIG_PATH[aarch64] $s/usr/lib/pkgconfig
CONFIGURE_OPTS[aarch64]+=" --with-openssl=$s/usr"
}

pre_configure() {
typeset arch="$1"

save_variable CC

PKG_CONFIG_PATH="${PKG_CONFIG_PATH[$arch]}" \
PANEL_LIBS=`pkg-config --libs panel`
export PANEL_LIBS

! cross_arch $arch && return

CC+=" --sysroot=${SYSROOT[$arch]}"
}

post_configure() {
restore_variable CC
}

post_install() {
python_compile \
-o0 -o1 -o2 \
-x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data'
}

TESTSUITE_SED="
1,/Tests result:/ {
/Tests result:/p
d
}
/ slowest tests:/,/^$/d
/Total duration/d
/^make:/d
"

launch_testsuite() {
# Test selection
EXTRATESTOPTS="-uall,-audio,-gui,-largefile,-network -w"
EXTRATESTOPTS+=" --ignorefile $SRCDIR/files/test.exclude"
export EXTRATESTOPTS
if [ -z "$SKIP_TESTSUITE" ] && ( [ -n "$BATCH" ] || ask_to_testsuite ); then
# The compilall test (rightly) gets upset if we force timestamps
save_variable FORCE_PYC_TIMESTAMP
unset FORCE_PYC_TIMESTAMP
BATCH=1 run_testsuite "$@" </dev/null
restore_variable FORCE_PYC_TIMESTAMP
else
SKIP_TESTSUITE=1 # skip the dtrace tests too
fi
}

test_dtrace() {
# Dtrace tests require elevated privileges. They will have been skipped
# as part of the full testsuite run.

[ -n "$SKIP_TESTSUITE" ] && return

typeset logf=$TMPDIR/testsuite-d.log
:> $logf
for dir in $TMPDIR/$BUILDDIR; do
pushd $dir >/dev/null || logerr "chdir $dir"
$PFEXEC $MAKE test TESTOPTS=test_dtrace | tee -a $logf
# Reset ownership on the python cache directories/files which will
# have been created with root ownership.
$PFEXEC chown -R "`stat -c %U $SRCDIR`" .
popd >/dev/null
done
sed "$TESTSUITE_SED" < $logf > $SRCDIR/testsuite-d.log
[ -s $SRCDIR/testsuite-d.log ] \
|| echo "dtrace tests have failed" >> $SRCDIR/testsuite-d.log
}

init
download_source $PROG $PROG $VER
patch_source
prep_build autoconf -autoreconf
build
launch_testsuite
test_dtrace
make_package
clean_up

# Vim hints
# vim:ts=4:sw=4:et:fdm=marker
Loading
Loading