Support $ASDF_PYTHON_DEFAULT_PACKAGES_FILE
This commit is contained in:
parent
b544ac9e51
commit
b66cede547
2 changed files with 6 additions and 4 deletions
|
@ -56,3 +56,5 @@ asdf-python can automatically install a default set of Python packages with pip
|
||||||
ansible
|
ansible
|
||||||
pipenv
|
pipenv
|
||||||
```
|
```
|
||||||
|
|
||||||
|
You can specify a non-default location of this file by setting a `ASDF_PYTHON_DEFAULT_PACKAGES_FILE` variable.
|
||||||
|
|
|
@ -21,11 +21,11 @@ install_python() {
|
||||||
}
|
}
|
||||||
|
|
||||||
install_default_python_packages() {
|
install_default_python_packages() {
|
||||||
local default_python_packages="${HOME}/.default-python-packages"
|
local packages_file="${ASDF_PYTHON_DEFAULT_PACKAGES_FILE:-$HOME/.default-python-packages}"
|
||||||
|
|
||||||
if [ ! -f $default_python_packages ]; then return; fi
|
if [ ! -f "$packages_file" ]; then return; fi
|
||||||
|
|
||||||
cat "$default_python_packages" | while read -r name; do
|
while read -r name; do
|
||||||
echo -ne "\nInstalling \033[33m${name}\033[39m python package... "
|
echo -ne "\nInstalling \033[33m${name}\033[39m python package... "
|
||||||
PATH="$ASDF_INSTALL_PATH/bin:$PATH" pip install "$name" > /dev/null 2>&1 && rc=$? || rc=$?
|
PATH="$ASDF_INSTALL_PATH/bin:$PATH" pip install "$name" > /dev/null 2>&1 && rc=$? || rc=$?
|
||||||
if [[ $rc -eq 0 ]]; then
|
if [[ $rc -eq 0 ]]; then
|
||||||
|
@ -33,7 +33,7 @@ install_default_python_packages() {
|
||||||
else
|
else
|
||||||
echo -e "\033[31mFAIL\033[39m"
|
echo -e "\033[31mFAIL\033[39m"
|
||||||
fi
|
fi
|
||||||
done
|
done < "$packages_file"
|
||||||
}
|
}
|
||||||
|
|
||||||
ensure_python_build_installed
|
ensure_python_build_installed
|
||||||
|
|
Loading…
Reference in a new issue