|
195 | 195 |
|
196 | 196 | # Explicit version out of VCS when PIP supported URL is provided |
197 | 197 | if $source =~ /^'(git\+|hg\+|bzr\+|svn\+)(http|https|ssh|svn|sftp|ftp|lp|git)(:\/\/).+'$/ { |
| 198 | + if $::operatingsystem == 'windows' { fail('Windows support not yet implemented') } |
198 | 199 | if $_ensure != present and $_ensure != latest { |
199 | 200 | $command = "${pip_install} ${install_args} ${pip_common_args}@${_ensure}#egg=${egg_name}" |
200 | 201 | $unless_command = "${pip_env} list | grep -i -e '${grep_regex}'" |
|
277 | 278 |
|
278 | 279 | default: { |
279 | 280 | # Anti-action, uninstall. |
280 | | - if $::operatingsystem == 'windows' { fail('Not implemented yet') } |
281 | | - $command = "echo y | ${pip_env} uninstall ${uninstall_args} ${proxy_flag} ${name}" |
282 | | - $unless_command = "! ${pip_env} list | grep -i -e '${grep_regex}'" |
| 281 | + if $::operatingsystem != 'windows' { |
| 282 | + $command = "echo y | ${pip_env} uninstall ${uninstall_args} ${proxy_flag} ${name}" |
| 283 | + $unless_command = "! ${pip_env} list | grep -i -e '${grep_regex}'" |
| 284 | + } else { |
| 285 | + $command = "${pip_env} uninstall -y ${uninstall_args} ${proxy_flag} ${name}" |
| 286 | + $unless_command = join(["${python_env}/${python_executable} -c \"", |
| 287 | + "import subprocess;", |
| 288 | + "import sys;", |
| 289 | + "import re;", |
| 290 | + "package_name='${pkgname_with_dashes}';", |
| 291 | + "pip = lambda x: subprocess.Popen('${pip_env}'.split() + x, stdout=subprocess.PIPE, stderr=subprocess.STDOUT).communicate()[0];", |
| 292 | + "res = re.compile('^'+package_name+'==(.+)$', re.MULTILINE).search(pip(['freeze', '--all']));", |
| 293 | + "installed_version = res and res.group(1).strip() or None;", |
| 294 | + "sys.exit(installed_version is not None);\"",]) |
| 295 | + } |
283 | 296 | } |
284 | 297 | } |
285 | 298 | } |
|
0 commit comments