Skip to content

Commit

Permalink
Resolves issues with newer versions of pip not having a --use-mirrors…
Browse files Browse the repository at this point in the history
… paramater for the install command
  • Loading branch information
jctanner committed Jan 6, 2014
1 parent 5f8a906 commit 5923b56
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion library/packaging/pip
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ def main():
pip = _get_pip(module, env, module.params['executable'])

cmd = '%s %s' % (pip, state_map[state])
cmd_opts = None

# If there's a virtualenv we want things we install to be able to use other
# installations that exist as binaries within this virtualenv. Example: we
Expand Down Expand Up @@ -319,7 +320,11 @@ def main():
is_local_path = True
# for tarball or vcs source, applying --use-mirrors doesn't really make sense
is_package = is_vcs or is_tar or is_local_path # just a shortcut for bool
if not is_package and state != 'absent' and use_mirrors:

if cmd_opts is None:
cmd_opts = _get_cmd_options(module, cmd)

if not is_package and state != 'absent' and use_mirrors and '--use-mirrors' in cmd_opts:
cmd += ' --use-mirrors'
cmd += ' %s' % _get_full_name(name, version)
elif requirements:
Expand Down

0 comments on commit 5923b56

Please sign in to comment.