Skip to content

Commit 126b922

Browse files
committed
fixed issue with windows wheels
1 parent bdc9067 commit 126b922

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

patch_wheels.sh

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,21 @@ process_wheel() {
6565
mv "$distinfo" "$new_distinfo"
6666
local meta="$new_distinfo/METADATA"
6767

68-
# remove numpy<2, ensure plain numpy, patch Name and Home-page
69-
sed '/^Requires-Dist: numpy<2$/d' "$meta" > "$meta.tmp" && mv "$meta.tmp" "$meta"
70-
if ! grep -q '^Requires-Dist: numpy$' "$meta"; then
71-
echo "Requires-Dist: numpy" >> "$meta"
68+
# detect line ending style
69+
if grep -q $'\r' "$meta"; then
70+
EOL=$'\r\n'
71+
else
72+
EOL=$'\n'
7273
fi
73-
sed -i.bak \
74-
-e 's/^Name: mediapipe$/Name: mediapipe-numpy2/' \
75-
-e 's|^Home-page: .*|Home-page: https://github.com/cansik/mediapipe-numpy2|' \
74+
75+
# remove numpy<2 (handle optional CR), ensure plain numpy, patch Name and Home-page preserving original EOL
76+
sed -i.bak -E '/^Requires-Dist: numpy<2(\r)?$/d' "$meta"
77+
if ! grep -q -E '^Requires-Dist: numpy(\r)?$' "$meta"; then
78+
printf "Requires-Dist: numpy%s" "$EOL" >> "$meta"
79+
fi
80+
sed -i.bak -E \
81+
-e 's/^(Name: mediapipe)(\r)?$/\1-numpy2\2/' \
82+
-e 's|^(Home-page: ).*(\r)?$|\1https://github.com/cansik/mediapipe-numpy2\2|' \
7683
"$meta"
7784
rm -f "$meta.bak"
7885

0 commit comments

Comments
 (0)