New module argument to specify the executable used for running 'easy_install'. This allows support for system installation of packages on systems with multiple installations of Python.

This commit is contained in:
Pedro Romano 2013-08-16 12:01:56 +01:00 committed by Michael DeHaan
parent 48e50a9c11
commit 3c33273071

View file

@ -57,6 +57,16 @@ options:
C(pyvenv), C(virtualenv), C(virtualenv2). C(pyvenv), C(virtualenv), C(virtualenv2).
required: false required: false
default: virtualenv default: virtualenv
executable:
description:
- The explicit executable or a pathname to the executable to be used to
run easy_install for a specific version of Python installed in the
system. For example C(easy_install-3.3), if there are both Python 2.7
and 3.3 installations in the system and you want to run easy_install
for the Python 3.3 installation.
version_added: "1.3"
required: false
default: null
notes: notes:
- Please note that the M(easy_install) module can only install Python - Please note that the M(easy_install) module can only install Python
libraries. Thus this module is not able to remove libraries. It is libraries. Thus this module is not able to remove libraries. It is
@ -88,12 +98,14 @@ def main():
virtualenv=dict(default=None, required=False), virtualenv=dict(default=None, required=False),
virtualenv_site_packages=dict(default='no', type='bool'), virtualenv_site_packages=dict(default='no', type='bool'),
virtualenv_command=dict(default='virtualenv', required=False), virtualenv_command=dict(default='virtualenv', required=False),
executable=dict(default='easy_install', required=False),
) )
module = AnsibleModule(argument_spec=arg_spec, supports_check_mode=True) module = AnsibleModule(argument_spec=arg_spec, supports_check_mode=True)
name = module.params['name'] name = module.params['name']
env = module.params['virtualenv'] env = module.params['virtualenv']
easy_install = module.get_bin_path(module.params['executable'], True, ['%s/bin' % env])
site_packages = module.params['virtualenv_site_packages'] site_packages = module.params['virtualenv_site_packages']
virtualenv_command = module.params['virtualenv_command'] virtualenv_command = module.params['virtualenv_command']