|
32 | 32 | # source installation if the package itself is in constraints.
|
33 | 33 | - not source_install | bool
|
34 | 34 |
|
| 35 | + - name: "Detect Python version in virtualenv" |
| 36 | + command: "{{ ansible_python_interpreter }} -c 'import sys; print(\".\".join(map(str, sys.version_info[:3])))'" |
| 37 | + register: ansible_python_interpreter_version |
| 38 | + |
35 | 39 | - name: "Install {{ package }} package from pip using virtualenv"
|
36 | 40 | pip:
|
37 | 41 | name: "{{ package }}"
|
|
45 | 49 | retries: "{{ pip_install_retries }}"
|
46 | 50 | delay: "{{ pip_install_delay }}"
|
47 | 51 | when: not source_install | bool
|
48 |
| - environment: "{{ (bifrost_venv_env | combine({'SETUPTOOLS_USE_DISTUTILS': 'stdlib'})) if ansible_facts.python_version is version('3.12', '<') else bifrost_venv_env }}" |
| 52 | + environment: "{{ (bifrost_venv_env | combine({'SETUPTOOLS_USE_DISTUTILS': 'stdlib'})) if ansible_python_interpreter_version.stdout is version('3.12', '<') else bifrost_venv_env }}" |
49 | 53 |
|
50 | 54 | - name: "Install requirements from {{ sourcedir }} using pip"
|
51 | 55 | pip:
|
|
56 | 60 | retries: 5
|
57 | 61 | delay: 10
|
58 | 62 | when: source_install | bool
|
59 |
| - environment: "{{ (bifrost_venv_env | combine({'SETUPTOOLS_USE_DISTUTILS': 'stdlib'})) if ansible_facts.python_version is version('3.12', '<') else bifrost_venv_env }}" |
| 63 | + environment: "{{ (bifrost_venv_env | combine({'SETUPTOOLS_USE_DISTUTILS': 'stdlib'})) if ansible_python_interpreter_version.stdout is version('3.12', '<') else bifrost_venv_env }}" |
60 | 64 |
|
61 | 65 | # NOTE(dtantsur): do not use constraints here, it does not work when the
|
62 | 66 | # package itself is constrained.
|
|
66 | 70 | editable: "{{ developer_mode | bool }}"
|
67 | 71 | extra_args: "{{ extra_args }}"
|
68 | 72 | when: source_install | bool
|
69 |
| - environment: "{{ (bifrost_venv_env | combine({'SETUPTOOLS_USE_DISTUTILS': 'stdlib'})) if ansible_facts.python_version is version('3.12', '<') else bifrost_venv_env }}" |
| 73 | + environment: "{{ (bifrost_venv_env | combine({'SETUPTOOLS_USE_DISTUTILS': 'stdlib'})) if ansible_python_interpreter_version.stdout is version('3.12', '<') else bifrost_venv_env }}" |
0 commit comments