e95ee9c938
Made-with: Cursor
75 lines
2.1 KiB
YAML
75 lines
2.1 KiB
YAML
- name: Create contained Python runtime manager virtual environment
|
|
command:
|
|
argv:
|
|
- /usr/bin/python3
|
|
- -m
|
|
- venv
|
|
- "{{ courseware_uv_dir }}"
|
|
args:
|
|
creates: "{{ courseware_uv_dir }}/bin/python"
|
|
|
|
- name: Upgrade contained Python runtime manager tooling
|
|
command:
|
|
argv:
|
|
- "{{ courseware_uv_dir }}/bin/python"
|
|
- -m
|
|
- pip
|
|
- install
|
|
- --upgrade
|
|
- pip
|
|
- setuptools
|
|
- wheel
|
|
|
|
- name: Install contained Python runtime manager
|
|
command:
|
|
argv:
|
|
- "{{ courseware_uv_dir }}/bin/python"
|
|
- -m
|
|
- pip
|
|
- install
|
|
- "{{ courseware_uv_spec }}"
|
|
|
|
- name: Install managed CPython runtime
|
|
command:
|
|
argv:
|
|
- "{{ courseware_uv_bin }}"
|
|
- python
|
|
- install
|
|
- "{{ courseware_python_runtime_version }}"
|
|
- --install-dir
|
|
- "{{ courseware_python_runtime_dir }}"
|
|
environment:
|
|
UV_PYTHON_INSTALL_DIR: "{{ courseware_python_runtime_dir }}"
|
|
UV_CACHE_DIR: "{{ courseware_uv_cache_dir }}"
|
|
XDG_CACHE_HOME: "{{ courseware_cache_dir }}"
|
|
TMPDIR: "{{ courseware_tmp_dir }}"
|
|
register: courseware_python_runtime_install
|
|
changed_when: "'Installed Python' in courseware_python_runtime_install.stdout"
|
|
|
|
- name: Resolve managed CPython runtime
|
|
command:
|
|
argv:
|
|
- "{{ courseware_uv_bin }}"
|
|
- python
|
|
- find
|
|
- "{{ courseware_python_runtime_version }}"
|
|
environment:
|
|
UV_PYTHON_INSTALL_DIR: "{{ courseware_python_runtime_dir }}"
|
|
UV_CACHE_DIR: "{{ courseware_uv_cache_dir }}"
|
|
XDG_CACHE_HOME: "{{ courseware_cache_dir }}"
|
|
TMPDIR: "{{ courseware_tmp_dir }}"
|
|
register: courseware_python_runtime_find
|
|
changed_when: false
|
|
|
|
- name: Set managed Python runtime for courseware venvs
|
|
set_fact:
|
|
courseware_python_bin: "{{ courseware_python_runtime_find.stdout | trim }}"
|
|
|
|
- name: Verify managed Python runtime version
|
|
command:
|
|
argv:
|
|
- "{{ courseware_python_bin }}"
|
|
- -c
|
|
- "import sys; expected=tuple(map(int, '{{ courseware_python_runtime_version }}'.split('.'))); raise SystemExit(0 if sys.version_info[:len(expected)] == expected else 1)"
|
|
changed_when: false
|