![Aurelio Jargas](/assets/img/avatar_default.png)
Uv (https://docs.astral.sh/uv/) is not declared as a dependency for a Python project, it must be available somehow in the system. This role installs it if missing. - Latest version is installed, unless `ensure_uv_version` is informed. - The installed executable path is set as the `uv_executable` fact. - The `/usr/local/bin/uv` symlink can also be created if `ensure_uv_global_symlink: true`. This new role is a verbatim copy of the `ensure-poetry` role, just doing a `s/poetry/uv/g`. Even this commit is a replay of the commit adding that role: 524b7e7b95dcd6adc311e74dd7f0e6da8a3cce58. Change-Id: I55bc5e1d273045d0978b09f719bf79a875336e30
36 lines
1.2 KiB
YAML
36 lines
1.2 KiB
YAML
- hosts: all
|
|
name: Test ensure-uv installs into user environment
|
|
tasks:
|
|
- name: Verify uv is not installed
|
|
command: "uv --version"
|
|
register: result
|
|
failed_when: result.rc == 0
|
|
- name: Run ensure-uv with uv not installed
|
|
include_role:
|
|
name: ensure-uv
|
|
- name: Verify ensure_uv_executable is set
|
|
assert:
|
|
that:
|
|
- ensure_uv_executable == ansible_user_dir + '/.local/uv/bin/uv'
|
|
- name: Verify uv is installed
|
|
command: "{{ ensure_uv_executable }} --version"
|
|
register: result
|
|
failed_when: result.rc != 0
|
|
|
|
- hosts: all
|
|
name: Test ensure-uv when ensure_uv_executable is set to an already installed uv
|
|
tasks:
|
|
- name: Create a virtualenv
|
|
command: "{{ ensure_pip_virtualenv_command }} {{ ansible_user_dir }}/uv-venv"
|
|
- name: Install uv to local venv
|
|
command: "{{ ansible_user_dir }}/uv-venv/bin/pip install uv"
|
|
- name: Run ensure-uv pointing to an already installed uv
|
|
include_role:
|
|
name: ensure-uv
|
|
vars:
|
|
ensure_uv_executable: "{{ ansible_user_dir }}/uv-venv/bin/uv"
|
|
- name: Verify ensure_uv_executable is set to the virtualenv uv
|
|
assert:
|
|
that:
|
|
- ensure_uv_executable == ansible_user_dir + '/uv-venv/bin/uv'
|