Skip to content

Commit b971d37

Browse files
committed
fix: avoid msys path conversion in release packaging
- run Python archive helpers from local working directories - pass relative paths so Windows Git Bash does not leak POSIX temp paths into native Python
1 parent f82dc99 commit b971d37

1 file changed

Lines changed: 24 additions & 9 deletions

File tree

scripts/release-package.sh

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ find "$PACKAGE_ROOT" -type f \( -name "*.pyc" -o -name "*.pyo" \) -delete
6868
cp -f "$ROOT_DIR/README.md" "$PACKAGE_ROOT/INSTALL.md"
6969

7070
tar -czf "$DIST_DIR/${PACKAGE_NAME}.tar.gz" -C "$TMP_DIR" "$PACKAGE_NAME"
71-
"$PYTHON_BIN" - "$DIST_DIR/${PACKAGE_NAME}.tar.gz" "$DIST_DIR/${PACKAGE_NAME}.tar.gz.sha256sum" <<'PY'
71+
(
72+
cd "$DIST_DIR"
73+
"$PYTHON_BIN" - "${PACKAGE_NAME}.tar.gz" "${PACKAGE_NAME}.tar.gz.sha256sum" <<'PY'
7274
from pathlib import Path
7375
import hashlib
7476
import sys
@@ -77,26 +79,39 @@ archive = Path(sys.argv[1])
7779
checksum = Path(sys.argv[2])
7880
checksum.write_text(hashlib.sha256(archive.read_bytes()).hexdigest() + "\n", encoding="utf-8")
7981
PY
82+
)
8083

81-
"$PYTHON_BIN" - "$TMP_DIR" "$PACKAGE_NAME" "$DIST_DIR/${PACKAGE_NAME}.zip" "$DIST_DIR/${PACKAGE_NAME}.zip.sha256sum" <<'PY'
84+
(
85+
cd "$TMP_DIR"
86+
"$PYTHON_BIN" - "$PACKAGE_NAME" "${PACKAGE_NAME}.zip" <<'PY'
8287
from pathlib import Path
83-
import hashlib
8488
import sys
8589
import zipfile
8690
87-
tmp_dir = Path(sys.argv[1])
88-
package_name = sys.argv[2]
89-
archive = Path(sys.argv[3])
90-
checksum = Path(sys.argv[4])
91-
package_root = tmp_dir / package_name
91+
package_name = sys.argv[1]
92+
archive = Path(sys.argv[2])
93+
package_root = Path(package_name)
9294
9395
with zipfile.ZipFile(archive, "w", compression=zipfile.ZIP_DEFLATED) as zf:
9496
for path in sorted(package_root.rglob("*")):
9597
if path.is_file():
96-
zf.write(path, path.relative_to(tmp_dir).as_posix())
98+
zf.write(path, path.as_posix())
99+
PY
100+
cp -f "${PACKAGE_NAME}.zip" "$DIST_DIR/${PACKAGE_NAME}.zip"
101+
)
97102

103+
(
104+
cd "$DIST_DIR"
105+
"$PYTHON_BIN" - "${PACKAGE_NAME}.zip" "${PACKAGE_NAME}.zip.sha256sum" <<'PY'
106+
from pathlib import Path
107+
import hashlib
108+
import sys
109+
110+
archive = Path(sys.argv[1])
111+
checksum = Path(sys.argv[2])
98112
checksum.write_text(hashlib.sha256(archive.read_bytes()).hexdigest() + "\n", encoding="utf-8")
99113
PY
114+
)
100115

101116
rm -rf "$TMP_DIR"
102117

0 commit comments

Comments
 (0)