Skip to content

Commit fc7aab2

Browse files
committed
Add python 3.13
1 parent c4db1c9 commit fc7aab2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+6204
-3
lines changed

build/python312/local.mog

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,7 @@ license LICENSE license=PSFv2
4444

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

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

5149
# Add mediated link for /usr/bin/python and python-config
5250
link path=usr/bin/python target=python3

build/python313/README

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
2+
Python module dependencies
3+
--------------------------
4+
5+
setuptools
6+
pip (and pip depends on setuptools! See "Bootstrap" below)
7+
8+
pkg
9+
cryptography
10+
setuptools-rust
11+
semantic-version
12+
typing-extensions
13+
tomli
14+
six
15+
cffi
16+
pycparser
17+
asn1crypto
18+
idna
19+
jsonrpclib
20+
jsonschema
21+
attrs
22+
pyrsistent
23+
js-regex
24+
orjson
25+
pycurl
26+
rapidjson
27+
coverage
28+
pyopenssl
29+
cryptography
30+
31+
bhyve (brand)
32+
pyyaml
33+
34+
glib2
35+
meson
36+
packaging
37+
38+
39+
Bootstrap
40+
---------
41+
42+
To bootstrap modules for a new python version, build 'setuptools' and 'pip'
43+
with the '-f bootstrap' flag, and install these bootstrap packages:
44+
45+
for m in setuptools pip; do
46+
{ cd $m; ./build.sh -f bootstrap -blt; }
47+
done
48+
pfexec pkg install {pip,setuptools}-3XX-bootstrap
49+
50+
then build again, without the bootstrap flag:
51+
52+
for m in setuptools pip; do
53+
{ cd $m; ./build.sh -blt; }
54+
done
55+
56+
and finally switch out the bootstrap packages for the real ones:
57+
58+
pfexec pkg install --reject pip-3XX-bootstrap pip-3XX
59+
pfexec pkg install --reject setuptools-3XX-bootstrap setuptools-3XX
60+

build/python313/build.sh

Lines changed: 202 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,202 @@
1+
#!/usr/bin/bash
2+
#
3+
# {{{ CDDL HEADER
4+
#
5+
# This file and its contents are supplied under the terms of the
6+
# Common Development and Distribution License ("CDDL"), version 1.0.
7+
# You may only use this file in accordance with the terms of version
8+
# 1.0 of the CDDL.
9+
#
10+
# A full copy of the text of the CDDL should have accompanied this
11+
# source. A copy of the CDDL is also available via the Internet at
12+
# http://www.illumos.org/license/CDDL.
13+
# }}}
14+
#
15+
# Copyright 2024 OmniOS Community Edition (OmniOSce) Association.
16+
#
17+
. ../../lib/build.sh
18+
19+
PROG=Python
20+
VER=3.13.1
21+
PKG=runtime/python-313
22+
MVER=${VER%.*}
23+
SUMMARY="$PROG $MVER"
24+
DESC="$SUMMARY"
25+
26+
BUILD_DEPENDS_IPS="
27+
developer/build/autoconf
28+
developer/pkg-config
29+
ooce/developer/autoconf-archive
30+
"
31+
RUN_DEPENDS_IPS="
32+
compress/bzip2
33+
database/sqlite-3
34+
library/expat
35+
library/libffi
36+
library/libxml2
37+
library/ncurses
38+
library/readline
39+
library/security/openssl-3
40+
library/zlib
41+
system/library/gcc-runtime
42+
developer/object-file
43+
"
44+
XFORM_ARGS="-D PYTHONVER=$MVER"
45+
46+
HARDLINK_TARGETS="
47+
usr/bin/python$MVER
48+
"
49+
SKIP_RTIME_CHECK=1
50+
NO_SONAME_EXPECTED=1
51+
52+
set_python_version $MVER
53+
set_arch 64
54+
55+
# To expose the CMSG_ macros and new recvmsg() semantics for the socket module
56+
set_standard XPG6
57+
58+
# Save arguments to the stack so that the mdb/pstack plugin can find them.
59+
CFLAGS[amd64]+=" -msave-args"
60+
CFLAGS[aarch64]+=" -mtls-dialect=trad"
61+
62+
export CCSHARED="-fPIC"
63+
CPPFLAGS+=" -I/usr/include/ncurses"
64+
export DFLAGS=-64
65+
MAKE_ARGS="
66+
DFLAGS=-64
67+
DESTSHARED=/usr/lib/python$MVER/lib-dynload
68+
"
69+
MAKE_INSTALL_ARGS=DESTSHARED=/usr/lib/python$MVER/lib-dynload
70+
71+
CONFIGURE_OPTS="
72+
--enable-shared
73+
--with-system-expat
74+
--enable-ipv6
75+
--without-ensurepip
76+
"
77+
78+
CONFIGURE_OPTS[amd64]+="
79+
--enable-optimizations
80+
--with-dtrace
81+
"
82+
83+
CONFIGURE_OPTS[aarch64]+="
84+
--build=${TRIPLETS[amd64]%.*}
85+
--with-build-python=$PYTHON
86+
ac_cv_file__dev_ptmx=yes
87+
ac_cv_file__dev_ptc=no
88+
"
89+
90+
# See https://bugs.python.org/issue25003
91+
# There is (was?) a bug in Python which massively slowed down os.urandom()
92+
# due to the introduction of a call to getentropy() which blocks until there
93+
# is sufficient entropy, and this affected pkg(7) significantly.
94+
# We tell Python that we don't have getentropy(); Solaris does the same.
95+
CONFIGURE_OPTS+=" ac_cv_func_getentropy=no "
96+
97+
# hstrerror() is present in -lresolv, but if configure decides it's available
98+
# then it uses it in a number of modules, which then don't link.
99+
# Versions of Python < 3.11 did not detect this function but the new checks
100+
# in 3.11 are less robust and think it's there even when it isn't.
101+
# https://github.com/python/cpython/issues/89886#issuecomment-1106100113
102+
CONFIGURE_OPTS+=" ac_cv_func_hstrerror=no"
103+
104+
# XXX
105+
CONFIGURE_OPTS+=" ac_cv_readline_rl_startup_hook_takes_args=no"
106+
107+
export DTRACE_CPP=$GCCPATH/bin/cpp
108+
109+
CURSES_CFLAGS="-DHAVE_NCURSESW -D_XOPEN_SOURCE_EXTENDED"
110+
LIBREADLINE_LIBS="-zrecord -lreadline -lncurses"
111+
export CURSES_CFLAGS LIBREADLINE_LIBS
112+
113+
build_init() {
114+
typeset s=${SYSROOT[aarch64]}
115+
116+
addpath PKG_CONFIG_PATH[aarch64] $s/usr/lib/pkgconfig
117+
CONFIGURE_OPTS[aarch64]+=" --with-openssl=$s/usr"
118+
}
119+
120+
pre_configure() {
121+
typeset arch="$1"
122+
123+
save_variable CC
124+
125+
PKG_CONFIG_PATH="${PKG_CONFIG_PATH[$arch]}" \
126+
PANEL_LIBS=`pkg-config --libs panel`
127+
export PANEL_LIBS
128+
129+
! cross_arch $arch && return
130+
131+
CC+=" --sysroot=${SYSROOT[$arch]}"
132+
}
133+
134+
post_configure() {
135+
restore_variable CC
136+
}
137+
138+
post_install() {
139+
python_compile \
140+
-o0 -o1 -o2 \
141+
-x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data'
142+
}
143+
144+
TESTSUITE_SED="
145+
1,/Tests result:/ {
146+
/Tests result:/p
147+
d
148+
}
149+
/ slowest tests:/,/^$/d
150+
/Total duration/d
151+
/^make:/d
152+
"
153+
154+
launch_testsuite() {
155+
# Test selection
156+
EXTRATESTOPTS="-uall,-audio,-gui,-largefile,-network -w"
157+
EXTRATESTOPTS+=" --ignorefile $SRCDIR/files/test.exclude"
158+
export EXTRATESTOPTS
159+
if [ -z "$SKIP_TESTSUITE" ] && ( [ -n "$BATCH" ] || ask_to_testsuite ); then
160+
# The compilall test (rightly) gets upset if we force timestamps
161+
save_variable FORCE_PYC_TIMESTAMP
162+
unset FORCE_PYC_TIMESTAMP
163+
BATCH=1 run_testsuite "$@" </dev/null
164+
restore_variable FORCE_PYC_TIMESTAMP
165+
else
166+
SKIP_TESTSUITE=1 # skip the dtrace tests too
167+
fi
168+
}
169+
170+
test_dtrace() {
171+
# Dtrace tests require elevated privileges. They will have been skipped
172+
# as part of the full testsuite run.
173+
174+
[ -n "$SKIP_TESTSUITE" ] && return
175+
176+
typeset logf=$TMPDIR/testsuite-d.log
177+
:> $logf
178+
for dir in $TMPDIR/$BUILDDIR; do
179+
pushd $dir >/dev/null || logerr "chdir $dir"
180+
$PFEXEC $MAKE test TESTOPTS=test_dtrace | tee -a $logf
181+
# Reset ownership on the python cache directories/files which will
182+
# have been created with root ownership.
183+
$PFEXEC chown -R "`stat -c %U $SRCDIR`" .
184+
popd >/dev/null
185+
done
186+
sed "$TESTSUITE_SED" < $logf > $SRCDIR/testsuite-d.log
187+
[ -s $SRCDIR/testsuite-d.log ] \
188+
|| echo "dtrace tests have failed" >> $SRCDIR/testsuite-d.log
189+
}
190+
191+
init
192+
download_source $PROG $PROG $VER
193+
patch_source
194+
prep_build autoconf -autoreconf
195+
build
196+
launch_testsuite
197+
test_dtrace
198+
make_package
199+
clean_up
200+
201+
# Vim hints
202+
# vim:ts=4:sw=4:et:fdm=marker

build/python313/common.mog

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# This file and its contents are supplied under the terms of the
2+
# Common Development and Distribution License ("CDDL"), version 1.0.
3+
# You may only use this file in accordance with the terms of version
4+
# 1.0 of the CDDL.
5+
#
6+
# A full copy of the text of the CDDL should have accompanied this
7+
# source. A copy of the CDDL is also available via the Internet at
8+
# http://www.illumos.org/license/CDDL.
9+
10+
# Copyright 2021 OmniOS Community Edition (OmniOSce) Association.
11+
12+
# Newer setup tools creates entry point scripts which do things like:
13+
#
14+
# try:
15+
# from importlib import metadata
16+
# except ImportError: # for Python<3.8
17+
# import importlib_metadata as metadata
18+
#
19+
# This causes the IPS dependency resolver to assume that both importlib and
20+
# importlib_metadata should exist, when in fact one is for Python < 3.8 and
21+
# one is for later versions. Depending on the python version, one or the other
22+
# will fail to be found.
23+
#
24+
# Therefore we bypass resolution of these dependencies.
25+
26+
<transform file path=.*/bin/ -> set pkg.depend.bypass-generate .*metadata.* >
27+
28+
# XXX - due to cross compilation in the virtual environment, scripts end up
29+
# with a venv shebang. This needs fixing but for now allow the failed
30+
# dependency.
31+
$(aarch64_ONLY)<transform file path=.*/bin/ \
32+
-> set pkg.depend.bypass-generate python>
33+

build/python313/common.sh

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# {{{ CDDL HEADER
2+
#
3+
# This file and its contents are supplied under the terms of the
4+
# Common Development and Distribution License ("CDDL"), version 1.0.
5+
# You may only use this file in accordance with the terms of version
6+
# 1.0 of the CDDL.
7+
#
8+
# A full copy of the text of the CDDL should have accompanied this
9+
# source. A copy of the CDDL is also available via the Internet at
10+
# http://www.illumos.org/license/CDDL.
11+
# }}}
12+
13+
# Copyright 2024 OmniOS Community Edition (OmniOSce) Association.
14+
15+
set_python_version 3.13
16+
17+
PYVER=$PYTHONVER # 3.13
18+
PYMVER=${PYTHONVER%%.*} # 3
19+
SPYVER=${PYTHONVER//./} # 313
20+
21+
RUN_DEPENDS_IPS="runtime/python-$SPYVER "
22+
XFORM_ARGS="
23+
-D PYTHONVER=$PYVER
24+
-D PYTHONLIB=${PYTHONLIB#/}/python$PYVER
25+
-D PYVER=$PYVER
26+
-D PYMVER=$PYMVER
27+
-D SPYVER=$SPYVER
28+
"
29+
30+
PKGDIFF_HELPER='
31+
s:(vendor-packages/[^-]*)-[0-9.]*:\1-VERSION:g
32+
'
33+
34+
# Python modules ship shared objects with no SONAME
35+
NO_SONAME_EXPECTED=1
36+
37+
# Use an extra directory level for building each module since there can be
38+
# multiple versions of python being built in parallel and if they are built
39+
# in the same directory then they will clobber each other.
40+
41+
# Do this now, before changing the temporary base
42+
init_repos
43+
44+
TMPDIR+="/python$PYVER"
45+
DTMPDIR+="/python$PYVER"
46+
BASE_TMPDIR=$TMPDIR
47+
48+
PEP518OPTS+=" --ignore-installed"
49+
50+
# Use the same python version for dependency resolution
51+
# XXX
52+
#PKGDEPEND="/usr/bin/python$PYTHONVER -Es $PKGDEPEND"
53+
54+
# Vim hints
55+
# vim:ts=4:sw=4:et:fdm=marker

build/python313/files/ctf.skip

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
amd64/libpython3\.so$

build/python313/files/test.exclude

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#
2+
# Elements on the python test suite to skip on OmniOS
3+
#
4+
# illumos does not support multiple SCM_RIGHTS messages in a packet
5+
*FDPassSeparate*
6+
#
7+
# Related to wchar_t differences on illumos
8+
*.test_re.ReTests.test_locale_compiled
9+
*.test_re.ReTests.test_locale_caching

0 commit comments

Comments
 (0)