re-implements #226

in optional (editable) way
with backward compatibility
This commit is contained in:
Felix Engelmann 2015-08-30 16:24:13 +02:00 committed by Matt Clay
parent 66a4cb5c13
commit abca0327b9

11
lib/ansible/modules/packaging/language/pip.py Normal file → Executable file
View file

@ -90,6 +90,12 @@ options:
required: false required: false
default: null default: null
version_added: "1.0" version_added: "1.0"
editable:
description:
- Pass the editable flag for versioning URLs.
required: false
default: yes
version_added: "2.0"
chdir: chdir:
description: description:
- cd into this directory before running the command - 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. # 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' - 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 # Install (MyApp) from local tarball
- pip: name='file:///path/to/MyApp.tar.gz' - pip: name='file:///path/to/MyApp.tar.gz'
@ -239,6 +248,7 @@ def main():
virtualenv_python=dict(default=None, required=False, type='str'), virtualenv_python=dict(default=None, required=False, type='str'),
use_mirrors=dict(default='yes', type='bool'), use_mirrors=dict(default='yes', type='bool'),
extra_args=dict(default=None, required=False), extra_args=dict(default=None, required=False),
editable=dict(default='yes', type='bool', required=False),
chdir=dict(default=None, required=False, type='path'), chdir=dict(default=None, required=False, type='path'),
executable=dict(default=None, required=False), executable=dict(default=None, required=False),
), ),
@ -312,6 +322,7 @@ def main():
# Automatically apply -e option to extra_args when source is a VCS url. VCS # Automatically apply -e option to extra_args when source is a VCS url. VCS
# includes those beginning with svn+, git+, hg+ or bzr+ # includes those beginning with svn+, git+, hg+ or bzr+
if name: if name:
if module.params['editable']:
if name.startswith('svn+') or name.startswith('git+') or \ if name.startswith('svn+') or name.startswith('git+') or \
name.startswith('hg+') or name.startswith('bzr+'): name.startswith('hg+') or name.startswith('bzr+'):
args_list = [] # used if extra_args is not used at all args_list = [] # used if extra_args is not used at all