From 887aef8514e6f7802f352ff1c2ea674645cecd33 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Tue, 27 Jan 2026 05:14:59 +0900 Subject: [PATCH] internal/rosa: python pip helper Fuse requires pytest which depends on many packages. This helper eases the pain of packaging them. Signed-off-by: Ophestra --- internal/rosa/python.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/internal/rosa/python.go b/internal/rosa/python.go index 4be17f6..f5c61db 100644 --- a/internal/rosa/python.go +++ b/internal/rosa/python.go @@ -1,6 +1,7 @@ package rosa import ( + "slices" "strings" "hakurei.app/internal/pkg" @@ -64,6 +65,26 @@ make DESTDIR=/work install } func init() { artifactsF[Python] = Toolchain.newPython } +// newViaPip is a helper for installing python dependencies via pip. +func (t Toolchain) newViaPip( + name, version, abi, platform, checksum, prefix string, + extra ...pkg.Artifact, +) pkg.Artifact { + wname := name + "-" + version + "-py3-" + abi + "-" + platform + ".whl" + return t.New(name+"-"+version, false, slices.Concat([]pkg.Artifact{ + t.Load(Python), + }, extra), nil, nil, ` +pip3 install \ + --no-index \ + --prefix=/system \ + --root=/work \ + /usr/src/`+wname+` +`, pkg.Path(AbsUsrSrc.Append(wname), false, pkg.NewHTTPGet( + nil, prefix+wname, + mustDecode(checksum), + ))) +} + func (t Toolchain) newSetuptools() pkg.Artifact { const ( version = "80.10.1"