Browse Source

Use a venv to build the python wheels

To limit the python packages installed on the host,
all packages installed by pip are implemented into
a venv.

While many of the repo_pip_packages may be available
via distribution packages, the versions vary wildly.
We therefore opt to use a venv instead to keep things
simple.

This reduces the requirement on the host to *only*
require the virtualenv package which is installed in
the openstack_hosts role.

The 'virtualenv' package is removed from the list as
it is not used.

Change-Id: I0619f51960e23756df7010d476d70f55ceda8441
Jesse Pretorius 8 months ago
parent
commit
d7acac1b99
3 changed files with 12 additions and 3 deletions
  1. 4
    1
      defaults/main.yml
  2. 4
    0
      tasks/repo_build_prepare.yml
  3. 4
    2
      tasks/repo_build_wheels.yml

+ 4
- 1
defaults/main.yml View File

@@ -112,12 +112,15 @@ repo_build_venv_command_options: >-
112 112
   --no-setuptools
113 113
   --no-wheel
114 114
 
115
+# Path to the repo build venv binaries
116
+repo_build_bin: "/openstack/venvs/repo-build-{{ repo_build_release_tag }}/bin"
117
+
118
+# Python packages to install into the repo build venv
115 119
 repo_pip_packages:
116 120
   - cython
117 121
   - pbr
118 122
   - requests
119 123
   - urllib3
120
-  - virtualenv
121 124
   - wheel
122 125
 
123 126
 repo_build_store_pip_sources: false

+ 4
- 0
tasks/repo_build_prepare.yml View File

@@ -102,6 +102,8 @@
102 102
       pip:
103 103
         name: "{{ repo_pip_packages }}"
104 104
         state: "{{ repo_build_pip_package_state }}"
105
+        virtualenv: "{{ repo_build_bin | dirname }}"
106
+        virtualenv_site_packages: "no"
105 107
         extra_args: >-
106 108
           --constraint {{ repo_build_release_path }}/requirements_constraints.txt
107 109
           {{ pip_install_options }}
@@ -114,6 +116,8 @@
114 116
       pip:
115 117
         name: "{{ repo_pip_packages }}"
116 118
         state: "{{ repo_build_pip_package_state }}"
119
+        virtualenv: "{{ repo_build_bin | dirname }}"
120
+        virtualenv_site_packages: "no"
117 121
         extra_args: >-
118 122
           --index-url {{ repo_build_pip_default_index }}
119 123
           --trusted-host {{ repo_build_pip_default_index | netloc_no_port }}

+ 4
- 2
tasks/repo_build_wheels.yml View File

@@ -41,7 +41,8 @@
41 41
 - name: Download requirement pip sources
42 42
   shell: >-
43 43
     set -o pipefail;
44
-    yes i | pip install --timeout {{ repo_build_timeout }}
44
+    yes i | {{ repo_build_bin }}/pip install
45
+    --timeout {{ repo_build_timeout }}
45 46
     --download {{ repo_build_output }}
46 47
     --no-binary :all:
47 48
     --constraint {{ repo_build_release_path }}/requirements_constraints.txt
@@ -61,7 +62,8 @@
61 62
 - name: Create OpenStack-Ansible requirement wheels
62 63
   shell: >-
63 64
     set -o pipefail;
64
-    pip wheel --timeout {{ repo_build_timeout }}
65
+    {{ repo_build_bin }}/pip wheel
66
+    --timeout {{ repo_build_timeout }}
65 67
     --wheel-dir {{ repo_build_output }}
66 68
     --find-links {{ repo_build_global_links_path }}
67 69
     --find-links {{ repo_build_output }}

Loading…
Cancel
Save