aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/rosa/python.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-01-19 01:58:53 +0900
committerOphestra <cat@gensokyo.uk>2026-01-19 01:58:53 +0900
commit574a64aa85e8a1842f8b26d554adee8b9a6e1415 (patch)
tree6bceca56f6ef3cc547adebe73e08fd17d04da77c /internal/rosa/python.go
parent85d27229fd4d73399badb1014f9363c15dd4451e (diff)
internal/rosa: cpython artifact
Dependency of llvm build scripts, also an optional cure dependency of ninja. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/rosa/python.go')
-rw-r--r--internal/rosa/python.go60
1 files changed, 60 insertions, 0 deletions
diff --git a/internal/rosa/python.go b/internal/rosa/python.go
new file mode 100644
index 00000000..274fe818
--- /dev/null
+++ b/internal/rosa/python.go
@@ -0,0 +1,60 @@
+package rosa
+
+import (
+ "strings"
+
+ "hakurei.app/internal/pkg"
+)
+
+// NewPython returns a [pkg.Artifact] containing an installation of Python.
+func (t Toolchain) NewPython() pkg.Artifact {
+ const (
+ version = "3.14.2"
+ checksum = "7nZunVMGj0viB-CnxpcRego2C90X5wFsMTgsoewd5z-KSZY2zLuqaBwG-14zmKys"
+ )
+ skipTests := []string{
+ // requires internet access (http://www.pythontest.net/)
+ "test_asyncio",
+ "test_socket",
+ "test_urllib2",
+ "test_urllibnet",
+ "test_urllib2net",
+
+ // hits std.PresetExt ruleset
+ "test_os",
+ "test_posix",
+ "test_shutil",
+
+ // somehow picks up mtime of source code
+ "test_zipfile",
+
+ // requires gcc
+ "test_ctypes",
+
+ // breaks on llvm
+ "test_dbm_gnu",
+ }
+ return t.New("python-"+version, []pkg.Artifact{
+ t.NewMake(),
+ t.NewZlib(),
+ }, nil, []string{
+ "EXTRATESTOPTS=-j0 -x " + strings.Join(skipTests, " -x "),
+ }, `
+# test_synopsis_sourceless assumes this is writable and checks __pycache__
+chmod -R +w /usr/src/python/
+
+export HOME="$(mktemp -d)"
+cd "$(mktemp -d)"
+/usr/src/python/configure \
+ --prefix=/system
+make "-j$(nproc)"
+make test
+make DESTDIR=/work install
+`, pkg.Path(AbsUsrSrc.Append("python"), true,
+ pkg.NewHTTPGetTar(
+ nil, "https://www.python.org/ftp/python/"+version+
+ "/Python-"+version+".tgz",
+ mustDecode(checksum),
+ pkg.TarGzip,
+ )))
+}