Merge pull request #91 from pn-space/patch-url

Enable to install with patch URL
This commit is contained in:
Daniel Perez 2021-04-15 13:52:23 +01:00 committed by GitHub
commit 57a4d725e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 3 deletions

1
.gitignore vendored
View file

@ -1,2 +1,3 @@
/pyenv
/pyenv_last_update
.DS_Store

View file

@ -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.

View file

@ -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