Skip to content

Commit

Permalink
Append custom parameter to the end of sys.argv
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere authored and nulano committed Mar 28, 2024
1 parent d9076fa commit e6fa5df
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
4 changes: 1 addition & 3 deletions _custom_build/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@
class _CustomBuildMetaBackend(backend_class):
def run_setup(self, setup_script="setup.py"):
if self.config_settings:
params = []
for key, values in self.config_settings.items():
if not isinstance(values, list):
values = [values]
for value in values:
params.append(f"--pillow-configuration={key}={value}")
sys.argv.append(f"--pillow-configuration={key}={value}")

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

def build_wheel(
Expand Down
5 changes: 2 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -998,10 +998,9 @@ def debug_build():


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

try:
setup(
Expand Down

0 comments on commit e6fa5df

Please sign in to comment.