Rework pipx toolset

This commit is contained in:
Vladimir Safonkin
2020-10-05 15:01:46 +03:00
parent d26db64941
commit 8750bf4011
3 changed files with 9 additions and 10 deletions

View File

@@ -11,17 +11,18 @@ toolset="$INSTALLER_SCRIPT_FOLDER/toolset.json"
pipx_packages=$(jq ".pipx[] .package" $toolset) pipx_packages=$(jq ".pipx[] .package" $toolset)
for package in $pipx_packages; do for package in $pipx_packages; do
python_path=$(jq ".pipx[] | select(.package == $package) .python" $toolset) python_version=$(jq -r ".pipx[] | select(.package == $package) .python" $toolset)
if [ "$python_path" = "default" ]; then if [ "$python_version" != "null" ]; then
echo "Install $package into default python" python_path="/opt/hostedtoolcache/Python/$python_version*/x64/bin/python$python_version"
pipx install $package
else
echo "Install $package into python $python_path" echo "Install $package into python $python_path"
pipx install $package --python $python_path pipx install $package --python $python_path
else
echo "Install $package into default python"
pipx install $package
fi fi
# Run tests to determine that the software installed as expected # Run tests to determine that the software installed as expected
cmd=$(jq ".pipx[] | select(.package == $package) .cmd" $toolset) cmd=$(jq -r ".pipx[] | select(.package == $package) .cmd" $toolset)
if ! command -v $cmd; then if ! command -v $cmd; then
echo "$package was not installed" echo "$package was not installed"
exit 1 exit 1

View File

@@ -192,12 +192,11 @@
"pipx": [ "pipx": [
{ {
"package": "yamllint", "package": "yamllint",
"python": "default",
"cmd": "yamllint" "cmd": "yamllint"
}, },
{ {
"package": "aws-sam-cli", "package": "aws-sam-cli",
"python": "/opt/hostedtoolcache/Python/3.7*/x64/bin/python3.7", "python": "3.7",
"cmd": "sam" "cmd": "sam"
} }
] ]

View File

@@ -155,12 +155,11 @@
"pipx": [ "pipx": [
{ {
"package": "yamllint", "package": "yamllint",
"python": "default",
"cmd": "yamllint" "cmd": "yamllint"
}, },
{ {
"package": "aws-sam-cli", "package": "aws-sam-cli",
"python": "/opt/hostedtoolcache/Python/3.7*/x64/bin/python3.7", "python": "3.7",
"cmd": "sam" "cmd": "sam"
} }
] ]