From ecad0d11c4c9c66f3756f14508aaf787b08c354e Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Sun, 14 Jul 2013 14:26:55 +0100 Subject: [PATCH] Let's have the packages to install as the last arguments to the `pip install` call. --- salt/modules/pip.py | 56 ++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/salt/modules/pip.py b/salt/modules/pip.py index 2ed0736c53..4183be6b70 100644 --- a/salt/modules/pip.py +++ b/salt/modules/pip.py @@ -235,34 +235,6 @@ def install(pkgs=None, if not salt.utils.is_windows(): cmd = ['.', _get_env_activate(bin_env), '&&'] + cmd - if pkgs: - if isinstance(pkgs, basestring): - pkgs = [p.strip() for p in pkgs.split(',')] - - # It's possible we replaced version-range commas with semicolons so - # they would survive the previous line (in the pip.installed state). - # Put the commas back in - cmd.extend( - [p.replace(';', ',') for p in pkgs] - ) - - if editable: - egg_match = re.compile(r'(?:#|#.*?&)egg=([^&]*)') - if isinstance(editable, basestring): - editable = [e.strip() for e in editable.split(',')] - - for entry in editable: - # Is the editable local? - if not entry.startswith(('file://', '/')): - match = egg_match.search(entry) - - if not match or not match.group(1): - # Missing #egg=theEggName - raise CommandExecutionError( - 'You must specify an egg for this editable' - ) - cmd.append('--editable={0}'.format(entry)) - treq = None if requirements: if requirements.startswith('salt://'): @@ -403,6 +375,34 @@ def install(pkgs=None, for opt in install_options: cmd.append('--install-option={0}'.format(opt)) + if pkgs: + if isinstance(pkgs, basestring): + pkgs = [p.strip() for p in pkgs.split(',')] + + # It's possible we replaced version-range commas with semicolons so + # they would survive the previous line (in the pip.installed state). + # Put the commas back in + cmd.extend( + [p.replace(';', ',') for p in pkgs] + ) + + if editable: + egg_match = re.compile(r'(?:#|#.*?&)egg=([^&]*)') + if isinstance(editable, basestring): + editable = [e.strip() for e in editable.split(',')] + + for entry in editable: + # Is the editable local? + if not entry.startswith(('file://', '/')): + match = egg_match.search(entry) + + if not match or not match.group(1): + # Missing #egg=theEggName + raise CommandExecutionError( + 'You must specify an egg for this editable' + ) + cmd.append('--editable={0}'.format(entry)) + try: cmd_kwargs = dict(runas=runas, cwd=cwd) if bin_env and os.path.isdir(bin_env):