|
7 | 7 | # @param systempkgs Copy system site-packages into virtualenv. |
8 | 8 | # @param venv_dir Directory to install virtualenv to |
9 | 9 | # @param ensure_venv_dir Create $venv_dir |
10 | | -# @param distribute Include distribute in the virtualenv |
| 10 | +# @param distribute |
| 11 | +# Include distribute in the virtualenv |
| 12 | +# Forced to `false` for Ubuntu 18.04 and 20.04 |
| 13 | +# Forced to `false` for RedHat based systems |
11 | 14 | # @param index Base URL of Python package index |
12 | 15 | # @param owner The owner of the virtualenv being manipulated |
13 | 16 | # @param group The group relating to the virtualenv being manipulated |
|
93 | 96 | } |
94 | 97 | } |
95 | 98 |
|
96 | | - # Virtualenv versions prior to 1.7 do not support the |
97 | | - # --system-site-packages flag, default off for prior versions |
98 | | - # Prior to version 1.7 the default was equal to --system-site-packages |
99 | | - # and the flag --no-site-packages had to be passed to do the opposite |
100 | | - $_virtualenv_version = getvar('virtualenv_version') ? { |
101 | | - /.*/ => getvar('virtualenv_version'), |
| 99 | + $system_pkgs_flag = $systempkgs ? { |
| 100 | + true => '--system-site-packages', |
102 | 101 | default => '', |
103 | 102 | } |
104 | 103 |
|
105 | | - if versioncmp($_virtualenv_version,'1.7') > 0 and $systempkgs == true { |
106 | | - $system_pkgs_flag = '--system-site-packages' |
107 | | - } elsif versioncmp($_virtualenv_version,'1.7') < 0 and $systempkgs == false { |
108 | | - $system_pkgs_flag = '--no-site-packages' |
| 104 | + # Installing distribute does not work on these operating systems |
| 105 | + if $facts.dig('os','distro','codename') in ['focal', 'bionic', 'buster'] { |
| 106 | + $distribute_pkg = 'setuptools' |
| 107 | + } elsif $facts['os']['family'] == 'RedHat' { |
| 108 | + $distribute_pkg = 'setuptools' |
109 | 109 | } else { |
110 | | - $system_pkgs_flag = $systempkgs ? { |
111 | | - true => '--system-site-packages', |
112 | | - default => '--no-site-packages', |
| 110 | + $distribute_pkg = $distribute ? { |
| 111 | + true => 'distribute', |
| 112 | + default => 'setuptools', |
113 | 113 | } |
114 | 114 | } |
115 | 115 |
|
116 | | - $distribute_pkg = $distribute ? { |
117 | | - true => 'distribute', |
118 | | - default => 'setuptools', |
119 | | - } |
120 | | - |
121 | 116 | $pypi_index = $index ? { |
122 | 117 | false => '', |
123 | 118 | default => "-i ${index}", |
|
0 commit comments