Browse Source

Ensure pip/setuptools/wheel are up to date in the wheel build venv

To ensure consistency, we make sure that the venv used for the wheel
build has an up to date and the right versions of pip/setuptools/wheel.

Change-Id: Iac3e5054b5ef482bba2954e40c2c4d32a7f863df
changes/05/615205/1
Jesse Pretorius 7 months ago
parent
commit
ecff328ed6
1 changed files with 43 additions and 2 deletions
  1. 43
    2
      tasks/repo_build_prepare.yml

+ 43
- 2
tasks/repo_build_prepare.yml View File

@@ -73,6 +73,11 @@
73 73
       (_wheel_build_constraints | changed) or
74 74
       (repo_build_wheel_rebuild | bool)
75 75
 
76
+- name: Create the virtualenv (if it does not exist)
77
+  command: "virtualenv --never-download --no-site-packages {{ repo_build_bin | dirname }}"
78
+  args:
79
+    creates: "{{ repo_build_bin }}/activate"
80
+
76 81
 # Note(odyssey4me):
77 82
 # To cater for a situation where the pip packages are changing, but the repo
78 83
 # does not yet have the package built, we need to ensure that this task can
@@ -82,6 +87,23 @@
82 87
   tags:
83 88
     - repo-build-install
84 89
   block:
90
+    - name: Upgrade pip/setuptools/wheel to the versions we want (from repo)
91
+      pip:
92
+        name:
93
+          - pip
94
+          - setuptools
95
+          - wheel
96
+        state: "{{ repo_build_pip_package_state }}"
97
+        virtualenv: "{{ repo_build_bin | dirname }}"
98
+        virtualenv_site_packages: "no"
99
+        extra_args: >-
100
+          --constraint {{ repo_build_release_path }}/requirements_constraints.txt
101
+          {{ pip_install_options | default('') }}
102
+      register: install_packages
103
+      until: install_packages is success
104
+      retries: 5
105
+      delay: 2
106
+
85 107
     - name: Install pip packages (from repo)
86 108
       pip:
87 109
         name: "{{ repo_pip_packages }}"
@@ -90,12 +112,31 @@
90 112
         virtualenv_site_packages: "no"
91 113
         extra_args: >-
92 114
           --constraint {{ repo_build_release_path }}/requirements_constraints.txt
93
-          {{ pip_install_options }}
115
+          {{ pip_install_options | default('') }}
94 116
       register: install_packages
95 117
       until: install_packages is success
96 118
       retries: 5
97 119
       delay: 5
98 120
   rescue:
121
+    - name: Upgrade pip/setuptools/wheel to the versions we want (from pypi mirror)
122
+      pip:
123
+        name:
124
+          - pip
125
+          - setuptools
126
+          - wheel
127
+        state: "{{ repo_build_pip_package_state }}"
128
+        virtualenv: "{{ repo_build_bin | dirname }}"
129
+        virtualenv_site_packages: "no"
130
+        extra_args: >-
131
+          --index-url {{ repo_build_pip_default_index }}
132
+          --trusted-host {{ repo_build_pip_default_index | netloc_no_port }}
133
+          --constraint {{ repo_build_release_path }}/requirements_constraints.txt
134
+          {{ pip_install_options | default('') }}
135
+      register: install_packages
136
+      until: install_packages is success
137
+      retries: 5
138
+      delay: 2
139
+
99 140
     - name: Install pip packages (from pypi mirror)
100 141
       pip:
101 142
         name: "{{ repo_pip_packages }}"
@@ -106,7 +147,7 @@
106 147
           --index-url {{ repo_build_pip_default_index }}
107 148
           --trusted-host {{ repo_build_pip_default_index | netloc_no_port }}
108 149
           --constraint {{ repo_build_release_path }}/requirements_constraints.txt
109
-          {{ pip_install_options }}
150
+          {{ pip_install_options | default('') }}
110 151
       register: install_packages
111 152
       until: install_packages is success
112 153
       retries: 5

Loading…
Cancel
Save