Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to get latest version of minor #518

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions linux/just_files/just_install_functions.bsh
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ function conda-install()

# install conda
bash "${CONDA_INSTALLER}" -b -p "${conda_dir}" -s
# Conda installer doesn't support spacer, PERIOD!
# Conda installer doesn't support spaces, PERIOD!
# ERROR: Cannot install into directories with spaces

# conda executable
Expand Down Expand Up @@ -351,7 +351,7 @@ function conda-install()
# * else: system level conda if available, then temporary miniconda3 download
#
# :Arguments: * [``--dir {dir}``] - Python install directory
# * [``--version {version}``] - Python version for install (default= ``${PYTHON_VERSION:-3.6.9}``)
# * [``--version {version}``] - Python version for install (default= ``${PYTHON_VERSION:-3.6.9}``). Specifying ``3.x`` will auto select the latest in the 3.x versions.
# * [``--conda {CONDA}``] - Conda executable
# * [``--conda-installer {INSTALLER}``] - Conda installer
# * [``--download``] - Download miniconda
Expand Down Expand Up @@ -385,6 +385,14 @@ function conda-python-install()
--list list_versions \
-- ${@+"${@}"}

local minor_version_pattern='^([0-9]+)\.([0-9]+)$'
local install_version="==${python_ver}"
local check_version=("${install_version}")
if [[ ${python_ver} =~ ${minor_version_pattern} ]]; then
check_version=(">=${BASH_REMATCH[0]}" "<${BASH_REMATCH[1]}.$((${BASH_REMATCH[2]}+1))")
install_version="${check_version[0]},${check_version[1]}"
fi

if [ "${list_versions}" != "0" ]; then
# This has worked since at least 2016, so fairly stable
download_to_stdout https://anaconda.org/anaconda/python/files | sed -n${sed_flag_rE} 's|^ *<a href=".*/anaconda/python/files\?version=([0-9.]*)">|\1|p'
Expand Down Expand Up @@ -439,7 +447,7 @@ function conda-python-install()
if [ -r "${conda_activate-}" ]; then
source "${conda_activate}"
fi
"${CONDA}" create -y -p "${python_dir}" "python==${python_ver}" ${packages[@]+"${packages[@]}"}
"${CONDA}" create -y -p "${python_dir}" "python${install_version}" ${packages[@]+"${packages[@]}"}
)
local python_exe_footer
if [ "${OS-}" = "Windows_NT" ]; then
Expand All @@ -460,7 +468,7 @@ function conda-python-install()
echo "Python ${python_version} installed at \"${python_exe}\"" >&2

# Make sure python meets request
if ! meet_requirements "${python_version}" "==${python_ver}"; then
if ! meet_requirements "${python_version}" "${check_version[@]}"; then
echo "Python version ${python_version} is not the requested version ${python_ver}" >&2
JUST_IGNORE_EXIT_CODES=1
return 1
Expand Down
Loading