aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/rosa/python.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-04-20 01:25:43 +0900
committerOphestra <cat@gensokyo.uk>2026-04-20 01:25:43 +0900
commit39e4c5b8acf4abbf978a551ed7d608143722c618 (patch)
tree1d3102ef8f52f54a523fbe3fc874023c698f0126 /internal/rosa/python.go
parente8f6db38b6d298827025249b5c959c4d589c9796 (diff)
internal/rosa/python: optionally install before check
Some test suites require package to be installed globally. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/rosa/python.go')
-rw-r--r--internal/rosa/python.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/internal/rosa/python.go b/internal/rosa/python.go
index 9fbace8b..02153794 100644
--- a/internal/rosa/python.go
+++ b/internal/rosa/python.go
@@ -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
}