1
0
forked from rosa/hakurei

internal/rosa/python: optionally install before check

Some test suites require package to be installed globally.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2026-04-20 01:25:43 +09:00
parent e8f6db38b6
commit 39e4c5b8ac

View File

@@ -115,6 +115,8 @@ type PipHelper struct {
BuildIsolation bool BuildIsolation bool
// Whether to enter source after install. // Whether to enter source after install.
EnterSource bool EnterSource bool
// Whether to install to build environment after install.
Install bool
// Runs after install. // Runs after install.
Script string Script string
} }
@@ -144,6 +146,7 @@ func (attr *PipHelper) script(name string) string {
if attr == nil { if attr == nil {
attr = new(PipHelper) attr = new(PipHelper)
} }
sourcePath := AbsUsrSrc.Append(name).Append(attr.Append...)
var extra string var extra string
if !attr.BuildIsolation { if !attr.BuildIsolation {
@@ -152,6 +155,14 @@ func (attr *PipHelper) script(name string) string {
} }
script := attr.Script script := attr.Script
if attr.Install {
script = `pip3 install \
--no-index \
--prefix=/system \
--no-build-isolation \
'` + sourcePath.String() + `'
` + script
}
if attr.EnterSource { if attr.EnterSource {
script = "cd '/usr/src/" + name + "'\n" + script script = "cd '/usr/src/" + name + "'\n" + script
} }
@@ -161,7 +172,7 @@ pip3 install \
--no-index \ --no-index \
--prefix=/system \ --prefix=/system \
--root=/work \` + extra + ` --root=/work \` + extra + `
'` + AbsUsrSrc.Append(name).Append(attr.Append...).String() + `' '` + sourcePath.String() + `'
` + script ` + script
} }