Skip to content

Commit 577af8b

Browse files
authored
Merge pull request #2876 from gentlegiantJGC/main
Fixed string list concatenation error
2 parents b653408 + 6b0b410 commit 577af8b

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

changelog.d/2876.change.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
In the build backend, allow single config settings to be supplied.

setuptools/build_meta.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
import setuptools
3939
import distutils
4040
from ._reqs import parse_strings
41+
from .extern.more_itertools import always_iterable
42+
4143

4244
__all__ = ['get_requires_for_build_sdist',
4345
'get_requires_for_build_wheel',
@@ -127,9 +129,24 @@ def suppress_known_deprecation():
127129

128130
class _BuildMetaBackend:
129131

130-
def _fix_config(self, config_settings):
132+
@staticmethod
133+
def _fix_config(config_settings):
134+
"""
135+
Ensure config settings meet certain expectations.
136+
137+
>>> fc = _BuildMetaBackend._fix_config
138+
>>> fc(None)
139+
{'--global-option': []}
140+
>>> fc({})
141+
{'--global-option': []}
142+
>>> fc({'--global-option': 'foo'})
143+
{'--global-option': ['foo']}
144+
>>> fc({'--global-option': ['foo']})
145+
{'--global-option': ['foo']}
146+
"""
131147
config_settings = config_settings or {}
132-
config_settings.setdefault('--global-option', [])
148+
config_settings['--global-option'] = list(always_iterable(
149+
config_settings.get('--global-option')))
133150
return config_settings
134151

135152
def _get_build_requires(self, config_settings, requirements):

0 commit comments

Comments
 (0)