Skip to content

Commit 4e32536

Browse files
committed
Make the {project} placeholder available to repair-wheel-command
1 parent 3a52416 commit 4e32536

File tree

7 files changed

+14
-3
lines changed

7 files changed

+14
-3
lines changed

cibuildwheel/platforms/android.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,10 @@ def repair_wheel(state: BuildState, built_wheel: Path) -> Path:
435435
if state.options.repair_command:
436436
shell(
437437
prepare_command(
438-
state.options.repair_command, wheel=built_wheel, dest_dir=repaired_wheel_dir
438+
state.options.repair_command,
439+
wheel=built_wheel,
440+
dest_dir=repaired_wheel_dir,
441+
project=".",
439442
),
440443
env=state.build_env,
441444
)

cibuildwheel/platforms/linux.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,10 @@ def build_in_container(
320320
if build_options.repair_command:
321321
log.step("Repairing wheel...")
322322
repair_command_prepared = prepare_command(
323-
build_options.repair_command, wheel=built_wheel, dest_dir=repaired_wheel_dir
323+
build_options.repair_command,
324+
wheel=built_wheel,
325+
dest_dir=repaired_wheel_dir,
326+
project=container_project_path,
324327
)
325328
container.call(["sh", "-c", repair_command_prepared], env=env)
326329
else:

cibuildwheel/platforms/macos.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,7 @@ def build(options: Options, tmp_path: Path) -> None:
525525
wheel=built_wheel,
526526
dest_dir=repaired_wheel_dir,
527527
delocate_archs=delocate_archs,
528+
project=".",
528529
)
529530
shell(repair_command_prepared, env=env)
530531
else:

cibuildwheel/platforms/pyodide.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,7 @@ def build(options: Options, tmp_path: Path) -> None:
443443
build_options.repair_command,
444444
wheel=built_wheel,
445445
dest_dir=repaired_wheel_dir,
446+
project=".",
446447
)
447448
shell(repair_command_prepared, env=env)
448449
log.step_end()

cibuildwheel/platforms/windows.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,7 @@ def build(options: Options, tmp_path: Path) -> None:
525525
build_options.repair_command,
526526
wheel=built_wheel,
527527
dest_dir=repaired_wheel_dir,
528+
project=".",
528529
)
529530
shell(repair_command_prepared, env=env)
530531
else:

docs/options.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -904,6 +904,8 @@ The following placeholders must be used inside the command and will be replaced
904904
- `{dest_dir}` for the absolute path of the directory where to create the repaired wheel
905905
- `{delocate_archs}` (macOS only) comma-separated list of architectures in the wheel.
906906

907+
You can use the `{project}` placeholder in your `repair-wheel-command` to the project root.
908+
907909
The command is run in a shell, so you can run multiple commands like `cmd1 && cmd2`.
908910

909911
Platform-specific environment variables are also available:<br/>

test/test_custom_repair_wheel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def test(tmp_path, capfd):
4343
result = utils.cibuildwheel_run(
4444
project_dir,
4545
add_env={
46-
"CIBW_REPAIR_WHEEL_COMMAND": "python repair.py {wheel} {dest_dir}",
46+
"CIBW_REPAIR_WHEEL_COMMAND": "python {project}/repair.py {wheel} {dest_dir}",
4747
},
4848
)
4949

0 commit comments

Comments
 (0)