Skip to content
Merged
Changes from all 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
39 changes: 39 additions & 0 deletions resources/custom.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 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.
# - 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