Skip to content

Commit 01b1170

Browse files
authored
Create copy of nightly wheel without version number (#9091)
1 parent c6b157f commit 01b1170

File tree

1 file changed

+14
-9
lines changed
  • infra/ansible/roles/build_srcs/tasks

1 file changed

+14
-9
lines changed

infra/ansible/roles/build_srcs/tasks/main.yaml

+14-9
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,12 @@
9191

9292
- name: Rename and append +YYYYMMDD suffix to nightly wheels
9393
ansible.builtin.shell: |
94-
# For both torch and torch_xla, we would like to have one wheel without
95-
# date, and another copy of the same wheel with a date in the file name.
94+
# For both torch and torch_xla, we would like to have three copies of each
95+
# wheel. One with the date and version number, one with the version number
96+
# but no date, and one without date or version number.
9697
# This script normalizes wheel names to:
9798
#
99+
# torch_xla.dev-cp310-cp310-linux_x86_64.whl
98100
# torch_xla-2.5.0.dev-cp310-cp310-linux_x86_64.whl
99101
# torch_xla-2.5.0.dev20240819-cp310-cp310-linux_x86_64.whl (extra copy)
100102
#
@@ -110,10 +112,9 @@
110112
# group 5: anything from next - to the end: `cp310-cp310-linux_x86_64.whl`.
111113
rename -v "s/^(.*?)\-(.*?)(\+([^ -]+))?\-(.+)/\1-\2.dev-\5/" *.whl
112114
113-
# At this point, we have *.dev*.whl files. Now we want to produce the dated
114-
# YYYYMMDD versions as a second copy without losing the .dev one.
115+
# At this point, we have *.dev*.whl files. Now we want to produce the other
116+
# versions as copies without losing the .dev one.
115117
current_date="$(date -u +%Y%m%d)"
116-
wheels=( *.whl )
117118
118119
for f in *.whl; do
119120
if [[ "$f" == *".dev-"* ]]; then
@@ -122,10 +123,14 @@
122123
# torch-2.6.0.dev-cp310-cp310-linux_x86_64.whl
123124
# becomes
124125
# torch-2.6.0.dev20241206-cp310-cp310-linux_x86_64.whl
125-
newf="${f/.dev-/.dev${current_date}-}"
126-
127-
# Copy the file to the new filename.
128-
cp "$f" "$newf"
126+
datedf="${f/.dev-/.dev${current_date}-}"
127+
# Remove the version number. For example:
128+
# torch.dev-cp310-cp310-linux_x86_64.whl
129+
unversionedf="$(echo $f | sed 's/-.*\.dev/.dev/1')"
130+
131+
# Copy the file to the new filenames.
132+
cp "$f" "$datedf"
133+
cp "$f" "$unversionedf"
129134
fi
130135
done
131136
args:

0 commit comments

Comments
 (0)