From 2a97e9f2997136a13e7df72f8246cd33438087c0 Mon Sep 17 00:00:00 2001 From: Felix Engelmann Date: Sun, 30 Aug 2015 16:24:13 +0200 Subject: [PATCH] re-implements #226 in optional (editable) way with backward compatibility --- packaging/language/pip.py | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) mode change 100644 => 100755 packaging/language/pip.py diff --git a/packaging/language/pip.py b/packaging/language/pip.py old mode 100644 new mode 100755 index a4af27ccee5..bdd2b40a1aa --- a/packaging/language/pip.py +++ b/packaging/language/pip.py @@ -90,6 +90,12 @@ options: required: false default: null version_added: "1.0" + editable: + description: + - Pass the editable flag for versioning URLs. + required: false + default: yes + version_added: "2.0" chdir: description: - cd into this directory before running the command @@ -121,6 +127,9 @@ EXAMPLES = ''' # Install (MyApp) using one of the remote protocols (bzr+,hg+,git+,svn+). You do not have to supply '-e' option in extra_args. - pip: name='svn+http://myrepo/svn/MyApp#egg=MyApp' +# Install MyApp using one of the remote protocols (bzr+,hg+,git+) in a non editable way. +- pip: name='git+http://myrepo/app/MyApp' editable=false + # Install (MyApp) from local tarball - pip: name='file:///path/to/MyApp.tar.gz' @@ -239,6 +248,7 @@ def main(): virtualenv_python=dict(default=None, required=False, type='str'), use_mirrors=dict(default='yes', type='bool'), extra_args=dict(default=None, required=False), + editable=dict(default='yes', type='bool', required=False), chdir=dict(default=None, required=False, type='path'), executable=dict(default=None, required=False), ), @@ -312,15 +322,16 @@ def main(): # Automatically apply -e option to extra_args when source is a VCS url. VCS # includes those beginning with svn+, git+, hg+ or bzr+ if name: - if name.startswith('svn+') or name.startswith('git+') or \ - name.startswith('hg+') or name.startswith('bzr+'): - args_list = [] # used if extra_args is not used at all - if extra_args: - args_list = extra_args.split(' ') - if '-e' not in args_list: - args_list.append('-e') - # Ok, we will reconstruct the option string - extra_args = ' '.join(args_list) + if module.params['editable']: + if name.startswith('svn+') or name.startswith('git+') or \ + name.startswith('hg+') or name.startswith('bzr+'): + args_list = [] # used if extra_args is not used at all + if extra_args: + args_list = extra_args.split(' ') + if '-e' not in args_list: + args_list.append('-e') + # Ok, we will reconstruct the option string + extra_args = ' '.join(args_list) if extra_args: cmd += ' %s' % extra_args