Skip to content

Commit

Permalink
Rework python installation (#12)
Browse files Browse the repository at this point in the history
* stubs for windows

* msi install of go 1.20 / 1.21

* passive is better

* fix waiting

* yamlfmt

* make the installer more generic

* add note on where tools are installed

* update pattern for go

* dotnet windows

* format

* python -m pip > pip

* add rsync

* Rework python installation
  • Loading branch information
campbel authored Sep 29, 2023
1 parent ec46f28 commit d1464d4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 32 deletions.
6 changes: 0 additions & 6 deletions tools/python/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,8 @@ includes:
os: ./task_{{OS}}.yaml

tasks:
pyenv:
desc: Install pyenv
cmds:
- task: os:pyenv

install:
desc: Install python version
deps: [pyenv]
cmds:
- task: os:install
vars:
Expand Down
40 changes: 14 additions & 26 deletions tools/python/task_darwin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,21 @@
version: "3"

tasks:
pyenv:
status:
- command -v pyenv &>/dev/null
cmds:
- brew install pyenv

install:
desc: Install python version
status:
- |
VERSION="{{.VERSION}}"
if [[ -f .python-version ]]; then
VERSION=$(cat .python-version)
fi
pyenv version | grep $VERSION
- python3 --version | grep {{.VERSION}}
vars:
GLOBAL: false
TEMP_DIR:
sh: mktemp -d
VERSION: '{{ default "3.11.5" .VERSION }}'
# Versions is a space separated map of version to URL
VERSIONS: |
"3.11.5 https://www.python.org/ftp/python/3.11.5/python-3.11.5-macos11.pkg"
URL:
sh: echo "{{.VERSIONS}}" | grep {{.VERSION}} | head -n1 | awk '{print $2}'
cmds:
- |
if [[ -f .python-version ]]; then
pyenv install
elif [[ -z "{{.VERSION}}" ]]; then
pyenv install {{.VERSION}}
{{- if eq .GLOBAL "true"}}
pyenv global {{.VERSION}}
{{end}}
else
echo "No .python-version file found, and no version specified"
exit 1
fi
- defer: rm -rf {{.TEMP_DIR}}
- '{{if eq .URL ""}}echo "unsupported version: {{.VERSION}}"; exit 1{{end}}'
- echo "installing python {{.VERSION}}"
- curl -Lo {{.TEMP_DIR}}/python.pkg {{.URL}}
- sudo installer -pkg {{.TEMP_DIR}}/python.pkg -target /

0 comments on commit d1464d4

Please sign in to comment.