Skip to content

Commit 3cfbbbc

Browse files
fix: set executable permission on CLI binary in Python wheel
The repack step in build-wheels.mjs was producing wheels where copilot/bin/copilot had 0o644 (-rw-r--r--) permissions because setuptools strips the executable bit when building package data. After extracting the wheel for repack, restore chmod 0o755 on the CLI binary so that zf.write() captures the correct permissions. This ensures pip/uv install the binary as executable on Unix.
1 parent b904431 commit 3cfbbbc

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

python/scripts/build-wheels.mjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ async function repackWheelWithPlatform(srcWheel, destWheel, platformTag) {
240240
import sys
241241
import zipfile
242242
import tempfile
243+
import os
243244
from pathlib import Path
244245
245246
src_wheel = Path(sys.argv[1])
@@ -253,6 +254,11 @@ with tempfile.TemporaryDirectory() as tmpdir:
253254
with zipfile.ZipFile(src_wheel, 'r') as zf:
254255
zf.extractall(tmpdir)
255256
257+
# Restore executable bit on the CLI binary (setuptools strips it)
258+
for bin_path in (tmpdir / 'copilot' / 'bin').iterdir():
259+
if bin_path.name in ('copilot', 'copilot.exe'):
260+
bin_path.chmod(0o755)
261+
256262
# Find and update WHEEL file
257263
wheel_info_dirs = list(tmpdir.glob('*.dist-info'))
258264
if not wheel_info_dirs:

0 commit comments

Comments
 (0)