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