diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-03-04 18:01:18 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-03-05 00:20:27 +0900 |
| commit | d2c6d486b06073aa88ee1912d3587f657cd57304 (patch) | |
| tree | 42e7df590ee8cda255e4cd35f9bd5ff7f9b2f94f /internal/rosa/python.go | |
| parent | 6fdd800b2b421b32e7db373b576433126c4652a2 (diff) | |
internal/rosa: provide package metadata
This had to be done out-of-band because there was no way to efficiently represent these within Artifact.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/rosa/python.go')
| -rw-r--r-- | internal/rosa/python.go | 130 |
1 files changed, 81 insertions, 49 deletions
diff --git a/internal/rosa/python.go b/internal/rosa/python.go index 1c9a2fe7..2adee576 100644 --- a/internal/rosa/python.go +++ b/internal/rosa/python.go @@ -7,7 +7,7 @@ import ( "hakurei.app/internal/pkg" ) -func (t Toolchain) newPython() pkg.Artifact { +func (t Toolchain) newPython() (pkg.Artifact, string) { const ( version = "3.14.2" checksum = "7nZunVMGj0viB-CnxpcRego2C90X5wFsMTgsoewd5z-KSZY2zLuqaBwG-14zmKys" @@ -59,31 +59,52 @@ func (t Toolchain) newPython() pkg.Artifact { OpenSSL, Bzip2, XZ, - ) + ), version +} +func init() { + artifactsM[Python] = Metadata{ + f: Toolchain.newPython, + + Name: "python", + Description: "the Python programming language interpreter", + Website: "https://www.python.org/", + } } -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 { +func newViaPip( + name, description, version, abi, platform, checksum, prefix string, + extra ...PArtifact, +) Metadata { wname := name + "-" + version + "-py3-" + abi + "-" + platform + ".whl" - return t.New(name+"-"+version, 0, slices.Concat([]pkg.Artifact{ - t.Load(Python), - }, extra), nil, nil, ` + return Metadata{ + f: func(t Toolchain) (pkg.Artifact, string) { + extraRes := make([]pkg.Artifact, len(extra)) + for i, p := range extra { + extraRes[i] = t.Load(p) + } + + return t.New(name+"-"+version, 0, slices.Concat([]pkg.Artifact{ + t.Load(Python), + }, extraRes), 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), - ))) + nil, prefix+wname, + mustDecode(checksum), + ))), version + }, + + Name: "python-" + name, + Description: description, + Website: "https://pypi.org/project/" + name + "/", + } } -func (t Toolchain) newSetuptools() pkg.Artifact { +func (t Toolchain) newSetuptools() (pkg.Artifact, string) { const ( version = "80.10.1" checksum = "p3rlwEmy1krcUH1KabprQz1TCYjJ8ZUjOQknQsWh3q-XEqLGEd3P4VrCc7ouHGXU" @@ -101,53 +122,64 @@ pip3 install \ "v"+version+".tar.gz", mustDecode(checksum), pkg.TarGzip, - ))) + ))), version } -func init() { artifactsF[Setuptools] = Toolchain.newSetuptools } +func init() { + artifactsM[Setuptools] = Metadata{ + f: Toolchain.newSetuptools, -func (t Toolchain) newPygments() pkg.Artifact { - return t.newViaPip("pygments", "2.19.2", "none", "any", + Name: "setuptools", + Description: "the autotools of the Python ecosystem", + Website: "https://pypi.org/project/setuptools/", + } +} + +func init() { + artifactsM[Pygments] = newViaPip( + "pygments", + " a syntax highlighting package written in Python", + "2.19.2", "none", "any", "ak_lwTalmSr7W4Mjy2XBZPG9I6a0gwSy2pS87N8x4QEuZYif0ie9z0OcfRfi9msd", "https://files.pythonhosted.org/packages/"+ - "c7/21/705964c7812476f378728bdf590ca4b771ec72385c533964653c68e86bdc/") -} -func init() { artifactsF[Pygments] = Toolchain.newPygments } + "c7/21/705964c7812476f378728bdf590ca4b771ec72385c533964653c68e86bdc/", + ) -func (t Toolchain) newPluggy() pkg.Artifact { - return t.newViaPip("pluggy", "1.6.0", "none", "any", + artifactsM[Pluggy] = newViaPip( + "pluggy", + "the core framework used by the pytest, tox, and devpi projects", + "1.6.0", "none", "any", "2HWYBaEwM66-y1hSUcWI1MyE7dVVuNNRW24XD6iJBey4YaUdAK8WeXdtFMQGC-4J", "https://files.pythonhosted.org/packages/"+ - "54/20/4d324d65cc6d9205fabedc306948156824eb9f0ee1633355a8f7ec5c66bf/") -} -func init() { artifactsF[Pluggy] = Toolchain.newPluggy } + "54/20/4d324d65cc6d9205fabedc306948156824eb9f0ee1633355a8f7ec5c66bf/", + ) -func (t Toolchain) newPackaging() pkg.Artifact { - return t.newViaPip("packaging", "26.0", "none", "any", + artifactsM[Packaging] = newViaPip( + "packaging", + "reusable core utilities for various Python Packaging interoperability specifications", + "26.0", "none", "any", "iVVXcqdwHDskPKoCFUlh2x8J0Gyq-bhO4ns9DvUJ7oJjeOegRYtSIvLV33Bki-pP", "https://files.pythonhosted.org/packages/"+ - "b7/b9/c538f279a4e237a006a2c98387d081e9eb060d203d8ed34467cc0f0b9b53/") -} -func init() { artifactsF[Packaging] = Toolchain.newPackaging } + "b7/b9/c538f279a4e237a006a2c98387d081e9eb060d203d8ed34467cc0f0b9b53/", + ) -func (t Toolchain) newIniConfig() pkg.Artifact { - const version = "2.3.0" - return t.newViaPip("iniconfig", version, "none", "any", + artifactsM[IniConfig] = newViaPip( + "iniconfig", + "a small and simple INI-file parser module", + "2.3.0", "none", "any", "SDgs4S5bXi77aVOeKTPv2TUrS3M9rduiK4DpU0hCmDsSBWqnZcWInq9lsx6INxut", - "https://github.com/pytest-dev/iniconfig/releases/download/"+ - "v"+version+"/") -} -func init() { artifactsF[IniConfig] = Toolchain.newIniConfig } - -func (t Toolchain) newPyTest() pkg.Artifact { - const version = "9.0.2" - return t.newViaPip("pytest", version, "none", "any", + "https://files.pythonhosted.org/packages/"+ + "cb/b1/3846dd7f199d53cb17f49cba7e651e9ce294d8497c8c150530ed11865bb8/", + ) + artifactsM[PyTest] = newViaPip( + "pytest", + "the pytest framework", + "9.0.2", "none", "any", "IM2wDbLke1EtZhF92zvAjUl_Hms1uKDtM7U8Dt4acOaChMnDg1pW7ib8U0wYGDLH", - "https://github.com/pytest-dev/pytest/releases/download/"+ - version+"/", - t.Load(IniConfig), - t.Load(Packaging), - t.Load(Pluggy), - t.Load(Pygments), + "https://files.pythonhosted.org/packages/"+ + "3b/ab/b3226f0bd7cdcf710fbede2b3548584366da3b19b5021e74f5bde2a8fa3f/", + IniConfig, + Packaging, + Pluggy, + Pygments, ) } -func init() { artifactsF[PyTest] = Toolchain.newPyTest } |
