From 8223d3ee3f2c8f2004653859a1ac3a49fc109535 Mon Sep 17 00:00:00 2001 From: Lorin Hochstein Date: Fri, 17 Aug 2012 14:38:49 -0400 Subject: [PATCH] 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. --- library/pip | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/library/pip b/library/pip index 95d756616a..b26e208775 100755 --- a/library/pip +++ b/library/pip @@ -101,7 +101,6 @@ def main(): out = '' env = module.params['virtualenv'] - pip = _find_pip(module, env) if env: virtualenv = _find_virtualenv(module) @@ -112,6 +111,8 @@ def main(): out += out_venv err += err_venv + pip = _find_pip(module, env) + state = module.params['state'] name = module.params['name'] version = module.params['version'] @@ -154,15 +155,15 @@ def main(): changed = 'Successfully installed' in out_pip elif name: - + installed = _is_package_installed(name, pip, version) changed = ((installed and state == 'absent') or (not installed and state == 'present')) if changed: if state == 'present': - full_name = _get_full_name(name, version) - else: + full_name = _get_full_name(name, version) + else: full_name = name cmd = '%s %s %s' % (pip, command_map[state], full_name)