Merge pull request #2320 from tail/fix-pip-install-options

Fixed --install-option for pip module.
This commit is contained in:
Thomas S Hatch 2012-10-23 08:44:46 -07:00
commit bc783a7518

View File

@ -7,6 +7,7 @@ import logging
import tempfile import tempfile
import shutil import shutil
# Import Salt libs # Import Salt libs
from salt._compat import string_types
from salt.exceptions import CommandExecutionError, CommandNotFoundError from salt.exceptions import CommandExecutionError, CommandNotFoundError
# It would be cool if we could use __virtual__() in this module, though, since # It would be cool if we could use __virtual__() in this module, though, since
@ -288,8 +289,15 @@ def install(pkgs=None,
cmd = '{cmd} --no-download '.format(cmd=cmd) cmd = '{cmd} --no-download '.format(cmd=cmd)
if install_options: if install_options:
cmd = '{cmd} --install-options={install_options} '.format( opts = ''
cmd=cmd, install_options=install_options)
if isinstance(install_options, string_types):
install_options = [install_options]
for opt in install_options:
opts += '--install-option={opt} '.format(opt=opt)
cmd = '{cmd} {opts} '.format(cmd=cmd, opts=opts)
try: try:
result = __salt__['cmd.run_all'](cmd, runas=runas, cwd=cwd) result = __salt__['cmd.run_all'](cmd, runas=runas, cwd=cwd)