1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Add option to choose a specific make executable (#212)

* Add option to choose a specific make executable

* Add changelog fragment

* Fix pep8 issues

* Add ending dot to make option description

Co-Authored-By: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
Paul Fariello 2020-04-23 21:10:36 +02:00 committed by GitHub
parent cb535e9718
commit 546acdaac7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 6 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- "Add a make option to the make module to be able to choose a specific make executable"

View file

@ -39,6 +39,10 @@ options:
description: description:
- Use a custom Makefile. - Use a custom Makefile.
type: path type: path
make:
description:
- Use a specific make binary.
type: path
''' '''
EXAMPLES = r''' EXAMPLES = r'''
@ -109,15 +113,19 @@ def main():
params=dict(type='dict'), params=dict(type='dict'),
chdir=dict(type='path', required=True), chdir=dict(type='path', required=True),
file=dict(type='path'), file=dict(type='path'),
make=dict(type='path'),
), ),
supports_check_mode=True, supports_check_mode=True,
) )
# Build up the invocation of `make` we are going to use
# For non-Linux OSes, prefer gmake (GNU make) over make make_path = module.params['make']
make_path = module.get_bin_path('gmake', required=False) if make_path is None:
if not make_path: # Build up the invocation of `make` we are going to use
# Fall back to system make # For non-Linux OSes, prefer gmake (GNU make) over make
make_path = module.get_bin_path('make', required=True) make_path = module.get_bin_path('gmake', required=False)
if not make_path:
# Fall back to system make
make_path = module.get_bin_path('make', required=True)
make_target = module.params['target'] make_target = module.params['target']
if module.params['params'] is not None: if module.params['params'] is not None:
make_parameters = [k + '=' + str(v) for k, v in iteritems(module.params['params'])] make_parameters = [k + '=' + str(v) for k, v in iteritems(module.params['params'])]