|
153 | 153 | # version, this makes sure we only use wheels if they are supported and |
154 | 154 | # installed |
155 | 155 |
|
156 | | - |
157 | | - case $ensure { |
158 | | - /^((19|20)[0-9][0-9]-(0[1-9]|1[1-2])-([0-2][1-9]|3[0-1])|[0-9]+\.[0-9]+(\.[0-9]+)?)$/: { |
159 | | - # Version formats as per http://guide.python-distribute.org/specification.html#standard-versioning-schemes |
160 | | - # Explicit version. |
161 | | - exec { "pip_install_${name}": |
162 | | - command => "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { ${pip_env} --log ${log}/pip.log install ${install_args} \$wheel_support_flag ${proxy_flag} ${install_args} ${install_editable} ${source}==${ensure} || ${pip_env} --log ${log}/pip.log install ${install_args} ${proxy_flag} ${install_args} ${install_editable} ${source}==${ensure} ;}", |
163 | | - unless => "${pip_env} freeze | grep -i -e ${grep_regex}", |
164 | | - user => $owner, |
165 | | - cwd => $cwd, |
166 | | - environment => $environment, |
167 | | - path => ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin'], |
168 | | - timeout => $timeout, |
169 | | - } |
| 156 | + # Explicit version out of VCS when PIP supported URL is provided |
| 157 | + if $source =~ /^(git\+|hg\+|bzr\+|svn\+)(http|https|ssh|svn|sftp|ftp|lp)(:\/\/).+$/ { |
| 158 | + if $ensure != present and $ensure != latest { |
| 159 | + exec { "pip_install_${name}": |
| 160 | + command => "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { ${pip_env} --log ${log}/pip.log install ${install_args} \$wheel_support_flag ${proxy_flag} ${install_args} ${install_editable} ${source}@${ensure} || ${pip_env} --log ${log}/pip.log install ${install_args} ${proxy_flag} ${install_args} ${install_editable} ${source}@${ensure} ;}", |
| 161 | + unless => "${pip_env} freeze | grep -i -e ${grep_regex}", |
| 162 | + user => $owner, |
| 163 | + cwd => $cwd, |
| 164 | + environment => $environment, |
| 165 | + path => ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin'], |
| 166 | + timeout => $timeout, |
| 167 | + } |
| 168 | + } |
| 169 | + else { |
| 170 | + exec { "pip_install_${name}": |
| 171 | + command => "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { ${pip_env} --log ${log}/pip.log install ${install_args} \$wheel_support_flag ${proxy_flag} ${install_args} ${install_editable} ${source} || ${pip_env} --log ${log}/pip.log install ${install_args} ${proxy_flag} ${install_args} ${install_editable} ${source} ;}", |
| 172 | + unless => "${pip_env} freeze | grep -i -e ${grep_regex}", |
| 173 | + user => $owner, |
| 174 | + cwd => $cwd, |
| 175 | + environment => $environment, |
| 176 | + path => ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin'], |
| 177 | + timeout => $timeout, |
| 178 | + } |
170 | 179 | } |
| 180 | + } |
| 181 | + else { |
| 182 | + case $ensure { |
| 183 | + /^((19|20)[0-9][0-9]-(0[1-9]|1[1-2])-([0-2][1-9]|3[0-1])|[0-9]+\.[0-9]+(\.[0-9]+)?)$/: { |
| 184 | + # Version formats as per http://guide.python-distribute.org/specification.html#standard-versioning-schemes |
| 185 | + # Explicit version. |
| 186 | + exec { "pip_install_${name}": |
| 187 | + command => "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { ${pip_env} --log ${log}/pip.log install ${install_args} \$wheel_support_flag ${proxy_flag} ${install_args} ${install_editable} ${source}==${ensure} || ${pip_env} --log ${log}/pip.log install ${install_args} ${proxy_flag} ${install_args} ${install_editable} ${source}==${ensure} ;}", |
| 188 | + unless => "${pip_env} freeze | grep -i -e ${grep_regex}", |
| 189 | + user => $owner, |
| 190 | + cwd => $cwd, |
| 191 | + environment => $environment, |
| 192 | + path => ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin'], |
| 193 | + timeout => $timeout, |
| 194 | + } |
| 195 | + } |
171 | 196 |
|
172 | | - present: { |
173 | | - # Whatever version is available. |
174 | | - exec { "pip_install_${name}": |
175 | | - command => "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { ${pip_env} --log ${log}/pip.log install \$wheel_support_flag ${proxy_flag} ${install_args} ${install_editable} ${source} || ${pip_env} --log ${log}/pip.log install ${proxy_flag} ${install_args} ${install_editable} ${source} ;}", |
176 | | - unless => "${pip_env} freeze | grep -i -e ${grep_regex}", |
177 | | - user => $owner, |
178 | | - cwd => $cwd, |
179 | | - environment => $environment, |
180 | | - path => ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin'], |
181 | | - timeout => $timeout, |
| 197 | + present: { |
| 198 | + # Whatever version is available. |
| 199 | + exec { "pip_install_${name}": |
| 200 | + command => "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { ${pip_env} --log ${log}/pip.log install \$wheel_support_flag ${proxy_flag} ${install_args} ${install_editable} ${source} || ${pip_env} --log ${log}/pip.log install ${proxy_flag} ${install_args} ${install_editable} ${source} ;}", |
| 201 | + unless => "${pip_env} freeze | grep -i -e ${grep_regex}", |
| 202 | + user => $owner, |
| 203 | + cwd => $cwd, |
| 204 | + environment => $environment, |
| 205 | + path => ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin'], |
| 206 | + timeout => $timeout, |
| 207 | + } |
182 | 208 | } |
183 | | - } |
184 | 209 |
|
185 | | - latest: { |
186 | | - # Latest version. |
187 | | - exec { "pip_install_${name}": |
188 | | - command => "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { ${pip_env} --log ${log}/pip.log install --upgrade \$wheel_support_flag ${proxy_flag} ${install_args} ${install_editable} ${source} || ${pip_env} --log ${log}/pip.log install --upgrade ${proxy_flag} ${install_args} ${install_editable} ${source} ;}", |
189 | | - unless => "${pip_env} search ${source} | grep -i INSTALLED | grep -i latest", |
190 | | - user => $owner, |
191 | | - cwd => $cwd, |
192 | | - environment => $environment, |
193 | | - path => ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin'], |
194 | | - timeout => $timeout, |
| 210 | + latest: { |
| 211 | + # Latest version. |
| 212 | + exec { "pip_install_${name}": |
| 213 | + command => "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { ${pip_env} --log ${log}/pip.log install --upgrade \$wheel_support_flag ${proxy_flag} ${install_args} ${install_editable} ${source} || ${pip_env} --log ${log}/pip.log install --upgrade ${proxy_flag} ${install_args} ${install_editable} ${source} ;}", |
| 214 | + unless => "${pip_env} search ${source} | grep -i INSTALLED | grep -i latest", |
| 215 | + user => $owner, |
| 216 | + cwd => $cwd, |
| 217 | + environment => $environment, |
| 218 | + path => ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin'], |
| 219 | + timeout => $timeout, |
| 220 | + } |
195 | 221 | } |
196 | | - } |
197 | 222 |
|
198 | | - default: { |
199 | | - # Anti-action, uninstall. |
200 | | - exec { "pip_uninstall_${name}": |
201 | | - command => "echo y | ${pip_env} uninstall ${uninstall_args} ${proxy_flag}", |
202 | | - onlyif => "${pip_env} freeze | grep -i -e ${grep_regex}", |
203 | | - user => $owner, |
204 | | - cwd => $cwd, |
205 | | - environment => $environment, |
206 | | - path => ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin'], |
207 | | - timeout => $timeout, |
| 223 | + default: { |
| 224 | + # Anti-action, uninstall. |
| 225 | + exec { "pip_uninstall_${name}": |
| 226 | + command => "echo y | ${pip_env} uninstall ${uninstall_args} ${proxy_flag}", |
| 227 | + onlyif => "${pip_env} freeze | grep -i -e ${grep_regex}", |
| 228 | + user => $owner, |
| 229 | + cwd => $cwd, |
| 230 | + environment => $environment, |
| 231 | + path => ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin'], |
| 232 | + timeout => $timeout, |
| 233 | + } |
208 | 234 | } |
209 | 235 | } |
210 | 236 | } |
211 | | - |
212 | 237 | } |
0 commit comments