pip module - editable now applies to all packages

When editable is set to true, -e flag should be passed to all packages.
This change passes -e flag before each package name. However, if a
requirements file is used, then editable flag raises errors. Therefore,
editable and requirements are now mutually exclusive.

Fixes #77755

Signed-off-by: Nirmal Patel <nirmal@nirmal.dev>
pull/78039/head
Nirmal Patel 2 years ago
parent 379058e10f
commit bb12409d61

@ -0,0 +1,4 @@
bugfixes:
- pip - when editable set to true, '-e' flag is passed before each package.
When requirments file is used, editable flag does not pass '-e' to avoid
errors.

@ -655,7 +655,11 @@ def main():
umask=dict(type='str'),
),
required_one_of=[['name', 'requirements']],
mutually_exclusive=[['name', 'requirements'], ['executable', 'virtualenv']],
mutually_exclusive=[
['name', 'requirements'],
['executable', 'virtualenv'],
['editable', 'requirements'],
],
supports_check_mode=True,
)
@ -671,6 +675,7 @@ def main():
chdir = module.params['chdir']
umask = module.params['umask']
env = module.params['virtualenv']
editable = module.params['editable']
venv_created = False
if env and chdir:
@ -742,20 +747,14 @@ def main():
# if the version specifier is provided by version, append that into the package
packages[0] = Package(to_native(packages[0]), version)
if module.params['editable']:
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.extend(shlex.split(extra_args))
if name:
cmd.extend(to_native(p) for p in packages)
for p in packages:
if editable:
cmd.append('-e')
cmd.append(to_native(p))
elif requirements:
cmd.extend(['-r', requirements])
else:

Loading…
Cancel
Save