mirror of
https://github.com/pyenv/pyenv.git
synced 2026-09-10 23:56:17 -04:00
pyenv-binary: refuse build on macOS before compiling
`generate-installer` refuses a macOS archive, so the last step of the pipeline cannot succeed there. Left to fail on its own it does so only after a full source build has been spent, so check the platform up front, like the entry name guards above it.
This commit is contained in:
parent
094c0a80ed
commit
171b318f47
|
|
@ -73,11 +73,20 @@ latest )
|
|||
;;
|
||||
esac
|
||||
|
||||
os="$(uname -s)"
|
||||
|
||||
# `generate-installer' refuses a macOS archive, so the last step here cannot
|
||||
# succeed on one. Give up before the build rather than after it.
|
||||
if [ "$os" = "Darwin" ]; then
|
||||
echo "pyenv-binary: macOS archives are not supported yet" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# `pyenv install' puts a `<version>:<alias>' build under versions/<alias>.
|
||||
pyenv-install "$spec"
|
||||
pyenv-binary-save "$entry"
|
||||
|
||||
# Name the metadata and the archive the way `save' just named them.
|
||||
platform="$(uname -s | tr '[:upper:]' '[:lower:]')-$(uname -m)"
|
||||
platform="$(printf '%s' "$os" | tr '[:upper:]' '[:lower:]')-$(uname -m)"
|
||||
pyenv-binary-generate-installer "${entry}-${platform}.meta" \
|
||||
--archive-url "${archive_url%/}/${entry}-${platform}.tar.gz" -o "$entry"
|
||||
|
|
|
|||
|
|
@ -55,6 +55,12 @@ stub_build_environment() {
|
|||
assert_failure "pyenv-binary: \`latest' cannot be used as an entry name"
|
||||
}
|
||||
|
||||
@test "refuses to build on macOS before compiling anything" {
|
||||
create_stub uname 'case "$1" in -s) echo Darwin;; -m) echo arm64;; esac'
|
||||
run pyenv-binary-build 3.12.7:3.12.7-test --archive-url http://x/b
|
||||
assert_failure "pyenv-binary: macOS archives are not supported yet"
|
||||
}
|
||||
|
||||
@test "builds under the entry name and writes the archive and definition" {
|
||||
stub_build_environment
|
||||
cd "${BATS_TEST_TMPDIR}"
|
||||
|
|
|
|||
Loading…
Reference in a new issue