package rosa import ( "path" "slices" "strings" "hakurei.app/internal/pkg" ) func (t Toolchain) newPython() (pkg.Artifact, string) { const ( version = "3.14.4" checksum = "X0VRAAGOlCVldh4J9tRAE-YrJtDvqfQTJaqxKPXNX6YTPlwpR9GwA5WRIZDO-63s" ) return t.NewPackage("python", version, pkg.NewHTTPGetTar( nil, "https://www.python.org/ftp/python/"+version+ "/Python-"+version+".tgz", mustDecode(checksum), pkg.TarGzip, ), &PackageAttr{ // test_synopsis_sourceless assumes this is writable and checks __pycache__ Writable: true, Chmod: true, Env: []string{ "EXTRATESTOPTS=-j0 -x " + strings.Join([]string{ // requires internet access (http://www.pythontest.net/) "test_asyncio", "test_socket", "test_urllib2", "test_urllibnet", "test_urllib2net", // makes assumptions about uid_map/gid_map "test_os", "test_subprocess", // somehow picks up mtime of source code "test_zipfile", // requires gcc "test_ctypes", // breaks on llvm "test_dbm_gnu", }, " -x "), // _ctypes appears to infer something from the linker name "LDFLAGS=-Wl,--dynamic-linker=/system/lib/" + "ld-musl-" + linuxArch() + ".so.1", }, }, &MakeHelper{ Check: []string{"test"}, }, Zlib, Bzip2, Libffi, OpenSSL, PkgConfig, XZ, ), version } func init() { artifactsM[Python] = Metadata{ f: Toolchain.newPython, Name: "python", Description: "the Python programming language interpreter", Website: "https://www.python.org/", Dependencies: P{ Zlib, Bzip2, Libffi, OpenSSL, }, ID: 13254, } } // newViaPip installs a pip wheel from a url. func (t Toolchain) newViaPip( name, version, url, checksum string, extra ...PArtifact, ) pkg.Artifact { return t.New(name+"-"+version, 0, t.AppendPresets(nil, slices.Concat(P{Python}, extra)..., ), nil, nil, ` pip3 install \ --no-index \ --prefix=/system \ --root=/work \ '/usr/src/`+path.Base(url)+`' `, pkg.Path(AbsUsrSrc.Append(path.Base(url)), false, pkg.NewHTTPGet( nil, url, mustDecode(checksum), ))) } // newPypi creates [Metadata] for a [pypi] package. // // [pypi]: https://pypi.org/ func newPypi( name string, id int, description, version, interpreter, abi, platform, checksum string, extra ...PArtifact, ) Metadata { return Metadata{ f: func(t Toolchain) (pkg.Artifact, string) { return t.newViaPip(name, version, "https://files.pythonhosted.org/"+path.Join( "packages", interpreter, string(name[0]), name, name+"-"+version+"-"+interpreter+"-"+abi+"-"+platform+".whl", ), checksum, extra...), version }, Name: "python-" + name, Description: description, Website: "https://pypi.org/project/" + name + "/", Dependencies: slices.Concat(P{Python}, extra), ID: id, } } func (t Toolchain) newSetuptools() (pkg.Artifact, string) { const ( version = "82.0.1" checksum = "nznP46Tj539yqswtOrIM4nQgwLA1h-ApKX7z7ghazROCpyF5swtQGwsZoI93wkhc" ) return t.New("setuptools-"+version, 0, t.AppendPresets(nil, Python, ), nil, nil, ` pip3 install \ --no-index \ --prefix=/system \ --root=/work \ /usr/src/setuptools `, pkg.Path(AbsUsrSrc.Append("setuptools"), true, pkg.NewHTTPGetTar( nil, "https://github.com/pypa/setuptools/archive/refs/tags/"+ "v"+version+".tar.gz", mustDecode(checksum), pkg.TarGzip, ))), version } func init() { artifactsM[Setuptools] = Metadata{ f: Toolchain.newSetuptools, Name: "python-setuptools", Description: "the autotools of the Python ecosystem", Website: "https://pypi.org/project/setuptools/", Dependencies: P{ Python, }, ID: 4021, } } func init() { artifactsM[PythonPygments] = newPypi( "pygments", 3986, " a syntax highlighting package written in Python", "2.20.0", "py3", "none", "any", "qlyqX2YSXcV0Z8XgGaPttc_gkq-xsu_nYs6NFOcYnk-CX7qmcj45gG-h6DpwPIcO", ) artifactsM[PythonPluggy] = newPypi( "pluggy", 7500, "the core framework used by the pytest, tox, and devpi projects", "1.6.0", "py3", "none", "any", "2HWYBaEwM66-y1hSUcWI1MyE7dVVuNNRW24XD6iJBey4YaUdAK8WeXdtFMQGC-4J", ) artifactsM[PythonPackaging] = newPypi( "packaging", 60461, "reusable core utilities for various Python Packaging interoperability specifications", "26.0", "py3", "none", "any", "iVVXcqdwHDskPKoCFUlh2x8J0Gyq-bhO4ns9DvUJ7oJjeOegRYtSIvLV33Bki-pP", ) artifactsM[PythonIniConfig] = newPypi( "iniconfig", 114778, "a small and simple INI-file parser module", "2.3.0", "py3", "none", "any", "SDgs4S5bXi77aVOeKTPv2TUrS3M9rduiK4DpU0hCmDsSBWqnZcWInq9lsx6INxut", ) artifactsM[PythonPyTest] = newPypi( "pytest", 3765, "the pytest framework", "9.0.2", "py3", "none", "any", "IM2wDbLke1EtZhF92zvAjUl_Hms1uKDtM7U8Dt4acOaChMnDg1pW7ib8U0wYGDLH", PythonIniConfig, PythonPackaging, PythonPluggy, PythonPygments, ) }