Retrieve pip path after creating virtualenv

Retrieve the pip path after creating a non-existent virtualenv.
Prevents the problem of using the wrong pip if virtualenv doesn't
exist yet.
reviewable/pr18780/r1
Lorin Hochstein 12 years ago
parent 51e85b4bde
commit 449ab0635b

9
pip

@ -101,7 +101,6 @@ def main():
out = '' out = ''
env = module.params['virtualenv'] env = module.params['virtualenv']
pip = _find_pip(module, env)
if env: if env:
virtualenv = _find_virtualenv(module) virtualenv = _find_virtualenv(module)
@ -112,6 +111,8 @@ def main():
out += out_venv out += out_venv
err += err_venv err += err_venv
pip = _find_pip(module, env)
state = module.params['state'] state = module.params['state']
name = module.params['name'] name = module.params['name']
version = module.params['version'] version = module.params['version']
@ -154,15 +155,15 @@ def main():
changed = 'Successfully installed' in out_pip changed = 'Successfully installed' in out_pip
elif name: elif name:
installed = _is_package_installed(name, pip, version) installed = _is_package_installed(name, pip, version)
changed = ((installed and state == 'absent') or changed = ((installed and state == 'absent') or
(not installed and state == 'present')) (not installed and state == 'present'))
if changed: if changed:
if state == 'present': if state == 'present':
full_name = _get_full_name(name, version) full_name = _get_full_name(name, version)
else: else:
full_name = name full_name = name
cmd = '%s %s %s' % (pip, command_map[state], full_name) cmd = '%s %s %s' % (pip, command_map[state], full_name)

Loading…
Cancel
Save