Resolve version prefixes in package names

This commit is contained in:
macayu17 2026-08-08 22:41:11 +05:30 committed by Ivan Pozdeev
parent 5a31fea21b
commit a6ef1e70ba
3 changed files with 11 additions and 3 deletions

View file

@ -28,6 +28,8 @@ case "$version" in
;;
esac
version="$(pyenv-latest -f -k "$version")"
os="$(uname -s)"
arch="$(uname -m)"
distro=""

View file

@ -2,6 +2,10 @@
load test_helper
_setup() {
create_stub pyenv-latest '[ "$1" = "-f" ] && [ "$2" = "-k" ] && shift 2 && echo "$*"'
}
@test "completion lists installable versions" {
create_stub pyenv-install \
'[ "$*" = "--list --bare" ] && echo 3.13.14'
@ -40,12 +44,13 @@ load test_helper
assert_success "3.13.14-macos-15.5-arm64"
}
@test "generates a package name for FreeBSD" {
@test "resolves a version prefix when generating a package name" {
create_stub pyenv-latest '[ "$*" = "-f -k 3" ] && echo 3.14.7'
create_stub uname \
'case "$1" in -s) echo FreeBSD;; -m) echo amd64;; -r) echo 14.2-RELEASE-p3;; esac'
run pyenv-binary-package-name 3.13.14
assert_success "3.13.14-freebsd-14.2-release-p3-amd64"
run pyenv-binary-package-name 3
assert_success "3.14.7-freebsd-14.2-release-p3-amd64"
}
@test "rejects an invalid version name" {

View file

@ -7,6 +7,7 @@ load test_helper
# `generate-installer' behave the same on any test host.
stub_build_environment() {
create_stub pyenv-install 'mkdir -p "${PYENV_ROOT}/versions/${1##*:}/bin"'
create_stub pyenv-latest '[ "$1" = "-f" ] && [ "$2" = "-k" ] && shift 2 && echo "$*"'
create_stub uname 'case "$1" in -s) echo Linux;; -m) echo x86_64;; esac'
create_stub getconf 'echo "glibc 2.17"'
}