Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Cleanup mocks logic * Add test for `:latest`
- Loading branch information
1 parent
b64b0ab
commit f1a1f59
Showing
3 changed files
with
119 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,25 @@ | ||
DEFINITION_PREFIX="${DEFINITION%%:*}" | ||
DEFINITION_TYPE="${DEFINITION_PREFIX%%-*}" # TODO: support non-CPython versions | ||
if [[ "${DEFINITION}" != "${DEFINITION_PREFIX}" ]]; then | ||
DEFINITION_CANDIDATES=(\ | ||
$(python-build --definitions | \ | ||
grep -F "${DEFINITION_PREFIX}" | \ | ||
grep "^${DEFINITION_TYPE}" | \ | ||
sed -E -e '/-dev$/d' -e '/-src$/d' -e '/(b|rc)[0-9]+$/d' | \ | ||
sort -t. -k1,1r -k 2,2nr -k 3,3nr \ | ||
|| true)) | ||
DEFINITION="${DEFINITION_CANDIDATES}" | ||
VERSION_NAME="${DEFINITION##*/}" | ||
fi | ||
pyenv_install_resolve_latest() { | ||
local DEFINITION_PREFIX DEFINITION_TYPE | ||
local -a DEFINITION_CANDIDATES | ||
local DEFINITION="$1" | ||
|
||
DEFINITION_PREFIX="${DEFINITION%%:*}" | ||
DEFINITION_TYPE="${DEFINITION_PREFIX%%-*}" # TODO: support non-CPython versions | ||
if [[ "${DEFINITION}" != "${DEFINITION_PREFIX}" ]]; then | ||
DEFINITION_CANDIDATES=(\ | ||
$(python-build --definitions | \ | ||
grep -F "${DEFINITION_PREFIX}" | \ | ||
grep "^${DEFINITION_TYPE}" | \ | ||
sed -E -e '/-dev$/d' -e '/-src$/d' -e '/(b|rc)[0-9]+$/d' | \ | ||
sort -t. -k1,1r -k 2,2nr -k 3,3nr \ | ||
|| true)) | ||
DEFINITION="${DEFINITION_CANDIDATES}" | ||
fi | ||
echo "$DEFINITION" | ||
} | ||
|
||
for i in ${!DEFINITIONS[*]}; do | ||
DEFINITIONS[$i]="$(pyenv_install_resolve_latest "${DEFINITIONS[$i]}")" | ||
done | ||
|
||
unset pyenv_install_resolve_latest |