Skip to content

Commit e6fa5df

Browse files
radarherenulano
authored andcommitted
Append custom parameter to the end of sys.argv
1 parent d9076fa commit e6fa5df

2 files changed

Lines changed: 3 additions & 6 deletions

File tree

_custom_build/backend.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,12 @@
1111
class _CustomBuildMetaBackend(backend_class):
1212
def run_setup(self, setup_script="setup.py"):
1313
if self.config_settings:
14-
params = []
1514
for key, values in self.config_settings.items():
1615
if not isinstance(values, list):
1716
values = [values]
1817
for value in values:
19-
params.append(f"--pillow-configuration={key}={value}")
18+
sys.argv.append(f"--pillow-configuration={key}={value}")
2019

21-
sys.argv = sys.argv[:1] + params + sys.argv[1:]
2220
return super().run_setup(setup_script)
2321

2422
def build_wheel(

setup.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -998,10 +998,9 @@ def debug_build():
998998

999999

10001000
# parse configuration from _custom_build/backend.py
1001-
while len(sys.argv[1]) >= 2 and sys.argv[1].startswith("--pillow-configuration="):
1002-
_, key, value = sys.argv[1].split("=", 2)
1001+
while sys.argv[-1].startswith("--pillow-configuration="):
1002+
_, key, value = sys.argv.pop().split("=", 2)
10031003
configuration.setdefault(key, []).append(value)
1004-
del sys.argv[1]
10051004

10061005
try:
10071006
setup(

0 commit comments

Comments
 (0)