Skip to content

--config-settings recognizes only the last option #11681

Closed
@ghost

Description

Description

The doc said:

The user can supply configuration settings using the --config-settings command line option (which can be supplied multiple times, in order to specify multiple settings).

If setting multiple times like this:

pip wheel --config-settings="--build-option=--cffi" --config-settings="--build-option=--avx2" -v .

Only the last option is passed to backend: {'--build-option': '--avx2'}

It seems these code let the last option override the previous options:

if dest is None:
dest = {}
setattr(parser.values, option.dest, dest)
dest[key] = val

Expected behavior

All options are passed to backend: {'--build-option': ['--cffi', '--avx2']}

Modify the code like this:

    if dest is None:
        dest = {key: []}
        setattr(parser.values, option.dest, dest)
    dest[key].append(val)

pip version

22.3.1

Python version

3.10

OS

Windows 11

How to Reproduce

  1. define a custom PEP-517 hook get_requires_for_build_wheel
  2. let the hook print the config_settings argument
    def get_requires_for_build_wheel(config_settings=None):
        print('config_settings argument:', config_settings)
        return []

Output

No response

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions