Allow the developer constraints to be adjusted

In order to do a developer mode that allows installation of packages
from local file, which take precedence over the developer_mode
constraints, we need to allow the order of the constraints to be
changed.

This patch adds a "pip_install_developer_constraints" var which is used
to set the developer mode constraints. By default this will leave the
same behaviour but will allow additional constraints to be added, or the
developermode constraints file to be overriden altogether.

Change-Id: I67f880def4b16e519865cc18937807e80b0b82c8
This commit is contained in:
Andy McCrae 2017-05-26 11:59:33 +01:00
parent 39c16e1148
commit 33fc6b7673
3 changed files with 6 additions and 2 deletions

View File

@ -40,6 +40,7 @@
name: "{{ swift_requires_pip_packages }}" name: "{{ swift_requires_pip_packages }}"
state: "{{ swift_pip_package_state }}" state: "{{ swift_pip_package_state }}"
extra_args: >- extra_args: >-
{{ swift_developer_mode | ternary(pip_install_developer_constraints | default('--constraint /opt/developer-pip-constraints.txt'), '') }}
{{ (pip_install_upper_constraints is defined) | ternary('--constraint ' + pip_install_upper_constraints | default(''),'') }} {{ (pip_install_upper_constraints is defined) | ternary('--constraint ' + pip_install_upper_constraints | default(''),'') }}
{{ pip_install_options | default('') }} {{ pip_install_options | default('') }}
register: install_packages register: install_packages
@ -92,7 +93,7 @@
virtualenv: "{{ swift_bin | dirname }}" virtualenv: "{{ swift_bin | dirname }}"
virtualenv_site_packages: "no" virtualenv_site_packages: "no"
extra_args: >- extra_args: >-
{{ swift_developer_mode | ternary('--constraint /opt/developer-pip-constraints.txt', '') }} {{ swift_developer_mode | ternary(pip_install_developer_constraints | default('--constraint /opt/developer-pip-constraints.txt'), '') }}
{{ (pip_install_upper_constraints is defined) | ternary('--constraint ' + pip_install_upper_constraints | default(''),'') }} {{ (pip_install_upper_constraints is defined) | ternary('--constraint ' + pip_install_upper_constraints | default(''),'') }}
{{ pip_install_options | default('') }} {{ pip_install_options | default('') }}
register: install_packages register: install_packages

View File

@ -61,7 +61,7 @@
virtualenv_site_packages: "no" virtualenv_site_packages: "no"
virtualenv_command: "{{ swift_pypy_env | dirname }}/virtualenv" virtualenv_command: "{{ swift_pypy_env | dirname }}/virtualenv"
extra_args: >- extra_args: >-
{{ swift_developer_mode | ternary('--constraint /opt/developer-pip-constraints.txt', '') }} {{ swift_developer_mode | ternary(pip_install_developer_constraints | default('--constraint /opt/developer-pip-constraints.txt'), '') }}
{{ (pip_install_upper_constraints is defined) | ternary('--constraint ' + pip_install_upper_constraints | default(''),'') }} {{ (pip_install_upper_constraints is defined) | ternary('--constraint ' + pip_install_upper_constraints | default(''),'') }}
{{ pip_install_options | default('') }} {{ pip_install_options | default('') }}
register: install_packages register: install_packages

View File

@ -104,6 +104,9 @@
pip: pip:
requirements: "{{ item }}" requirements: "{{ item }}"
virtualenv: "{{ swift_venv_bin | dirname }}" virtualenv: "{{ swift_venv_bin | dirname }}"
extra_args: >-
{{ swift_developer_mode | ternary(pip_install_developer_constraints | default('--constraint /opt/developer-pip-constraints.txt'), '') }}
{{ pip_install_options | default('') }}
with_items: with_items:
- "/opt/swift/test-requirements.txt" - "/opt/swift/test-requirements.txt"
- name: Setup test.conf for testing - name: Setup test.conf for testing