Don't complain if a patch file doesn't exist for a particular version of python

I hope this isn't too controversial: I personally have this
`ASDF_PYTHON_PATCHES_DIRECTORY` globally set up on my machine, which is
super useful when I install/reinstall random versions of Python, but is
kind of annoying when I try to install versions of python that don't
actually need a patch: I have to create an empty file just to get it to
install.

With this change, I don't have to do that: instead I only have to create
`.patch` files for the versions of Python that need it.
This commit is contained in:
Jeremy Fleischman 2022-03-22 14:28:22 -07:00
parent 57a4d725e4
commit e3ada52ca4
No known key found for this signature in database
GPG key ID: 19319CD8416A642B

View file

@ -20,7 +20,7 @@ install_python() {
echo "python-build --patch $version $install_path" echo "python-build --patch $version $install_path"
echo "with patch file from: $ASDF_PYTHON_PATCH_URL" echo "with patch file from: $ASDF_PYTHON_PATCH_URL"
$(python_build_path) --patch "$version" "$install_path" < <(curl -sSL "$ASDF_PYTHON_PATCH_URL") $(python_build_path) --patch "$version" "$install_path" < <(curl -sSL "$ASDF_PYTHON_PATCH_URL")
elif [[ -n "${ASDF_PYTHON_PATCHES_DIRECTORY:-}" ]]; then elif [[ -n "${ASDF_PYTHON_PATCHES_DIRECTORY:-}" ]] && [[ -f ${ASDF_PYTHON_PATCHES_DIRECTORY}/${version}.patch ]]; then
local patch_file=${ASDF_PYTHON_PATCHES_DIRECTORY}/${version}.patch local patch_file=${ASDF_PYTHON_PATCHES_DIRECTORY}/${version}.patch
echo "python-build $version $install_path -p < $patch_file" echo "python-build $version $install_path -p < $patch_file"
$(python_build_path) "$version" "$install_path" -p < $patch_file $(python_build_path) "$version" "$install_path" -p < $patch_file