From d1464d4171056f982d49d7a85ca3bee04f28bbb1 Mon Sep 17 00:00:00 2001 From: Chris Campbell Date: Fri, 29 Sep 2023 10:53:57 -0600 Subject: [PATCH] Rework python installation (#12) * 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 --- tools/python/task.yaml | 6 ------ tools/python/task_darwin.yaml | 40 ++++++++++++----------------------- 2 files changed, 14 insertions(+), 32 deletions(-) diff --git a/tools/python/task.yaml b/tools/python/task.yaml index 0603480..6f006ed 100644 --- a/tools/python/task.yaml +++ b/tools/python/task.yaml @@ -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: diff --git a/tools/python/task_darwin.yaml b/tools/python/task_darwin.yaml index 331924e..9161b8e 100644 --- a/tools/python/task_darwin.yaml +++ b/tools/python/task_darwin.yaml @@ -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 /