Skip to content

Commit 3a63a7d

Browse files
committed
wip: Add python
1 parent cd43c02 commit 3a63a7d

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

pkg/src/modules/python.sh

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# shellcheck shell=bash
2+
3+
python.matrix() {
4+
local prefix='https://www.python.org'
5+
6+
local version=
7+
while read -r version; do
8+
printf '%s\n' "CPython|$version|linux|amd64|$prefix/ftp/python/${version#v}/Python-${version#v}.tar.xz"
9+
done < <(m.fetch_github_tags 'python/cpython')
10+
}
11+
12+
python.install() {
13+
local url="$1"
14+
local version="$2"
15+
16+
m.fetch -o './python.tar.xz' "$url"
17+
m.ensure tar xf './python.tar.xz'
18+
m.ensure mv ./Python-*/ './dir'
19+
m.ensure cd -- './dir'
20+
21+
./configure \
22+
--prefix="$PWD/prefix" \
23+
--enable-optimizations
24+
make -j"$(nproc)"
25+
make install
26+
27+
m.ensure cd '..' # FIXME
28+
29+
REPLY_DIR='./dir'
30+
REPLY_BINS=('./prefix/bin')
31+
}

pkg/src/util/m.sh

+8
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,14 @@ m.git_tag_to_versions_array() {
5858
unset _sha1 refspec
5959
}
6060

61+
m.fetch_github_tags() {
62+
local prefix="$1"
63+
64+
local {_,refspec}=
65+
while read -r _ refspec; do
66+
printf '%s\n' "${refspec#refs/tags/}"
67+
done < <(git ls-remote --refs --tags "https://github.com/$prefix")
68+
}
6169
m.fetch_github_release() {
6270
local repo="$1"
6371

0 commit comments

Comments
 (0)