diff --git a/README.md b/README.md index 1c6bb64..7badb74 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,19 @@ Python plugin for [asdf](https://github.com/asdf-vm/asdf) version manager asdf plugin-add python ``` +### Install with `--patch` + +> Enable to fix macOS 11 issues + +You can use environment variable `ASDF_PYTHON_PATCH_URL` to install with `--patch` like that: + +``` +export ASDF_PYTHON_PATCH_URL="https://github.com/python/cpython/commit/8ea6353.patch?full_index=1" +asdf install python 3.6.12 +``` + +or use environment variable `ASDF_PYTHON_PATCHES_DIRECTORY`. + ## Use Check [asdf](https://github.com/asdf-vm/asdf) readme for instructions on how to install & manage versions of Python. @@ -19,7 +32,6 @@ Under the hood, asdf-python uses [python-build](https://github.com/yyuu/pyenv/tr to build and install Python, check its [README](https://github.com/yyuu/pyenv/tree/master/plugins/python-build) for more information about build options and the [common build problems](https://github.com/pyenv/pyenv/wiki/Common-build-problems) wiki page for any issues encountered during installation of python versions. - ## Using multiple versions of Python A common request for Python is being able to use the `python2` and `python3` commands without needing to switch version. diff --git a/bin/install b/bin/install index f9aaf97..51fe2ed 100755 --- a/bin/install +++ b/bin/install @@ -16,8 +16,12 @@ install_python() { fi install_or_update_python_build - local patch_file=${ASDF_PYTHON_PATCHES_DIRECTORY}/${version}.patch - if [ -f "$patch_file" ]; then + if [[ -n "${ASDF_PYTHON_PATCH_URL:-}" ]]; then + echo "python-build --patch $version $install_path" + echo "with patch file from: $ASDF_PYTHON_PATCH_URL" + $(python_build_path) --patch "$version" "$install_path" < <(curl -sSL "$ASDF_PYTHON_PATCH_URL") + elif [[ -n "${ASDF_PYTHON_PATCHES_DIRECTORY:-}" ]]; then + local patch_file=${ASDF_PYTHON_PATCHES_DIRECTORY}/${version}.patch echo "python-build $version $install_path -p < $patch_file" $(python_build_path) "$version" "$install_path" -p < $patch_file else