From 74324b42e43c3ae9eb696069d73036f8d5e6fd9a Mon Sep 17 00:00:00 2001 From: Chris Novakovic Date: Fri, 21 Nov 2025 14:09:20 +0000 Subject: [PATCH 1/2] Install dependencies for python-rules This is the minimum set of software required for the python-rules tests to pass on FreeBSD. --- resources/custom.sh | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/resources/custom.sh b/resources/custom.sh index 124b5c0..43a0626 100755 --- a/resources/custom.sh +++ b/resources/custom.sh @@ -2,8 +2,47 @@ set -exu +# Downloads a pure-Python wheel from PyPI and outputs it on stdout. +pypi_wheel() { + local package="$1" + local version="$2" + + local initial="$(echo "$package" | sed -e 's/^\(.\).*/\1/')" + + curl -L "https://files.pythonhosted.org/packages/py3/${initial}/${package}/${package}-${version}-py3-none-any.whl" +} + +# Switch from the Quarterly Ports branch to Latest - Quarterly doesn't yet contain packages for Python 3.13 and 3.14. +mkdir -p /usr/local/etc/pkg/repos +echo 'FreeBSD: { url: "https://pkg.freebsd.org/${ABI}/latest" }' > /usr/local/etc/pkg/repos/freebsd-latest.conf +ASSUME_ALWAYS_YES=yes pkg update -f + # Install run-time dependencies for the pleasew script (https://github.com/thought-machine/please/blob/master/pleasew). ASSUME_ALWAYS_YES=yes pkg install curl # Install run-time dependencies for Please. ASSUME_ALWAYS_YES=yes pkg install bash git + +# Install dependencies for python-rules: +# - The python31* packages install various Python interpreters to /usr/local. They also install the dependencies +# necessary to run these interpreters, which is helpful for the "in-repo" Python interpreters we define for FreeBSD +# in the python-rules tests (which are really just extracted versions of these packages). +# - The py31*-sqlite3 packages install the sqlite3 standard library module for each interpreter installed above. +# - The python3 package installs a /usr/local/bin/python3 symlink that points to the interpreter for the default Python +# version, one of which will have been installed above. +# - Manually download and install pip (and, on Python < 3.12, its dependencies, setuptools and wheel) for each +# interpreter - ensurepip is stripped out of the python31* packages, and Ports currently contains only a single pip +# package for the default Python version. +pypi_wheel setuptools 80.9.0 > /tmp/setuptools.whl +pypi_wheel wheel 0.45.1 > /tmp/wheel.whl +pypi_wheel pip 25.3 > /tmp/pip.whl +for pyminor in 10 11 12 13 14; do + ASSUME_ALWAYS_YES=yes pkg install "python3$pyminor" "py3$pyminor-sqlite3" + if [ $pyminor -lt 12 ]; then + unzip /tmp/setuptools.whl -d /usr/local/lib/python3.$pyminor/site-packages + unzip /tmp/wheel.whl -d /usr/local/lib/python3.$pyminor/site-packages + fi + unzip /tmp/pip.whl -d /usr/local/lib/python3.$pyminor/site-packages +done +ASSUME_ALWAYS_YES=yes pkg install python3 +rm -f /tmp/setuptools.whl /tmp/wheel.whl /tmp/pip.whl From 5fc69f1e679e8304f43a4d988483e1645dc42a90 Mon Sep 17 00:00:00 2001 From: Chris Novakovic Date: Fri, 21 Nov 2025 14:18:30 +0000 Subject: [PATCH 2/2] Fix comment --- resources/custom.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/custom.sh b/resources/custom.sh index 43a0626..1d7d9c9 100755 --- a/resources/custom.sh +++ b/resources/custom.sh @@ -26,7 +26,7 @@ ASSUME_ALWAYS_YES=yes pkg install bash git # Install dependencies for python-rules: # - The python31* packages install various Python interpreters to /usr/local. They also install the dependencies # necessary to run these interpreters, which is helpful for the "in-repo" Python interpreters we define for FreeBSD -# in the python-rules tests (which are really just extracted versions of these packages). +# in python-rules (they're really just extracted versions of these packages). # - The py31*-sqlite3 packages install the sqlite3 standard library module for each interpreter installed above. # - The python3 package installs a /usr/local/bin/python3 symlink that points to the interpreter for the default Python # version, one of which will have been installed above.