Skip to content

Commit ce944d7

Browse files
authored
Regenerates RECORD file to reflect hash changes caused by sed'ing the version suffix (#1164)
1 parent 8df83a8 commit ce944d7

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

release/pypi/prep_binary_for_pypi.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,19 @@
1212
set -eou pipefail
1313
shopt -s globstar
1414

15+
# Function copied from manywheel/build_common.sh
16+
make_wheel_record() {
17+
FPATH=$1
18+
if echo $FPATH | grep RECORD >/dev/null 2>&1; then
19+
# if the RECORD file, then
20+
echo "$FPATH,,"
21+
else
22+
HASH=$(openssl dgst -sha256 -binary $FPATH | openssl base64 | sed -e 's/+/-/g' | sed -e 's/\//_/g' | sed -e 's/=//g')
23+
FSIZE=$(ls -nl $FPATH | awk '{print $5}')
24+
echo "$FPATH,sha256=$HASH,$FSIZE"
25+
fi
26+
}
27+
1528
OUTPUT_DIR=${OUTPUT_DIR:-$(pwd)}
1629

1730
tmp_dir="$(mktemp -d)"
@@ -49,6 +62,19 @@ for whl_file in "$@"; do
4962
# Example: torch-1.8.0+cpu.dist-info => torch-1.8.0.dist-info
5063
mv "${dist_info_folder}" "${dirname_dist_info_folder}/${basename_dist_info_folder/${version_with_suffix}/${version_no_suffix}}"
5164
cd "${whl_dir}"
65+
66+
# copied from manywheel/build_common.sh
67+
# regenerate the RECORD file with new hashes
68+
record_file="${dirname_dist_info_folder}/${basename_dist_info_folder/${version_with_suffix}/${version_no_suffix}}/RECORD"
69+
if [[ -e $record_file ]]; then
70+
echo "Generating new record file $record_file"
71+
rm -f $record_file
72+
# generate records for folders in wheel
73+
find * -type f | while read fname; do
74+
echo $(make_wheel_record $fname) >>$record_file
75+
done
76+
fi
77+
5278
zip -qr "${new_whl_file}" .
5379
)
5480
done

0 commit comments

Comments
 (0)