python_variants branch report
Vincent Habchi
vince at macports.org
Wed Aug 12 16:24:04 UTC 2026
Folks,
The python_variants branch is more or less ready to be tested in view of its (possible) merging into main. Let me remind you exactly what is on this branch:
– A python 1.1 PortGroup file that handles the upcoming freethreading Python releases. These releases, starting with 3.15, have their ‘names’ end with a -t (ex.: 315t). The problem is that the corresponding ${python.version} in Python 1.0 PortGroup is not guaranteed to be numeric any more. Solution: python 1.1 PortGroup guarantees ${python.version} to be numeric (315 for python3.15t) so that the current numeric comparisons in the various py-* ports are safe (ex.: if {${python.version} >= 310} … The new variable ${python.suffix} contains the full version (ex.: python3.15t → 315t), which must be used for dependencies.
– A python_variants 1.0 PortGroup file. This port group file allows the choice of a default python version using a variant specified in ${prefix}/etc/macports/variants.conf (ex.: +python315t). Inside a portfile, the allowed variants are specified using a line beginning with python_variants, and the selected variant is available in ${python.variant}, while ${python.branch} contains the corresponding suffix for the binary (ex.: 3.15t). The port group adds a depends_lib to the corresponding python port automatically. It handles the case where the variant does not correspond to the port name (ex.: variant 315t corresponds to port python315-freetheading-devel) using a trick on the python.variants line. Specific code to be executed for python variant handling can also be specified in a bloc python.variant_code. Detailed documentation is available in the PortGroup file.
– A perl_variants 1.0 PortGroup file. Same principle as python_variants, but for perl dependent ports. In this case, there is no ${perl.branch} variable since the variants are spelled with the separating dot (ex.: perl.variants 5.34 5.36 5.38 5.40 5.42). These two new portgroups mimic what FreeBSD port(1) does using mk.conf customisation.
- I have updated all p5-* ports to use recent perl versions up to 5.42.
- Many python using ports and py-* ports have been updated for the new portgroup syntax.
I would appreciate someone giving it a try (switch to the python_variants branch). So far, I’ve successfully built pandoc, which has a bevy of dependencies, boost 1.91 and a new py-weasyprint port that I need for work and which depends on several other py-* ports.
And now time to have a look at the solar eclipse… :)
Cheers,
Vincent
More information about the macports-dev
mailing list