Skip to content

Commit 84c7792

Browse files
authored
Append torch commit to wheel name (#67) (#69)
* Append torch commit if it is set * Remove git * Rename wheels * lint * refactor
1 parent 09cfa25 commit 84c7792

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

manywheel/build_common.sh

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,20 @@ if [[ "$BUILD_LIGHTWEIGHT" == "1" ]]; then
7373
build_version="${build_version}.lw"
7474
fi
7575

76+
if [[ -z "$PYTORCH_ROOT" ]]; then
77+
echo "Need to set PYTORCH_ROOT env variable"
78+
exit 1
79+
fi
80+
# Always append the pytorch commit to the build_version by querying Git
81+
pushd "$PYTORCH_ROOT"
82+
PYTORCH_COMMIT=$(git rev-parse HEAD)
83+
popd
84+
85+
# Append the commit as a ".git<shortsha>" suffix
86+
# This yields versions like: torch-2.5.0+rocm6.2.0.lw.gitabcd1234
87+
short_commit=$(echo "$PYTORCH_COMMIT" | cut -c1-8)
88+
build_version="${build_version}.git${short_commit}"
89+
7690
echo "Final build_version: $build_version"
7791

7892
export PYTORCH_BUILD_VERSION=$build_version
@@ -119,10 +133,7 @@ fi
119133
########################################################
120134
# Compile wheels as well as libtorch
121135
#######################################################
122-
if [[ -z "$PYTORCH_ROOT" ]]; then
123-
echo "Need to set PYTORCH_ROOT env variable"
124-
exit 1
125-
fi
136+
126137
pushd "$PYTORCH_ROOT"
127138
python setup.py clean
128139
retry pip install -r requirements.txt

0 commit comments

Comments
 (0)