Skip to content

Commit b13b34d

Browse files
committed
Fix sentencepiece: remove sudo, cd to python subdir, add wheel validation
1 parent 28c87ac commit b13b34d

1 file changed

Lines changed: 25 additions & 16 deletions

File tree

s/sentencepiece/sentencepiece_ubi_9.6.sh

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,17 @@ cmake .. \
3737
-DCMAKE_BUILD_TYPE=Release \
3838
-DSPM_ENABLE_SHARED=ON
3939
make -j"$(nproc)"
40-
sudo make install
41-
cd ..
40+
make install
41+
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
42+
cd ../python
4243

43-
# Build Python wheel
44-
cd python
44+
# Ensure LICENSE exists
4545
cp ../LICENSE .
4646

47+
# Build Python wheel
4748
pip3 install --upgrade pip setuptools wheel build
4849

49-
if ! (python3 -m build --wheel --no-isolation) ; then
50+
if ! python3 -m build --wheel --no-isolation ; then
5051
echo "------------------$PACKAGE_NAME:Build_fails-------------------------------------"
5152
echo "$PACKAGE_URL $PACKAGE_NAME"
5253
echo "$PACKAGE_NAME | $PACKAGE_URL | $PACKAGE_VERSION | GitHub | Fail | Build_Fails"
@@ -55,7 +56,12 @@ fi
5556

5657
# Install wheel
5758
WHEEL_FILE=$(find dist -name "*.whl" | head -1)
58-
if ! (pip3 install "$WHEEL_FILE") ; then
59+
if [ -z "$WHEEL_FILE" ]; then
60+
echo "Error: No wheel file found in dist directory"
61+
exit 1
62+
fi
63+
64+
if ! pip3 install "$WHEEL_FILE" ; then
5965
echo "------------------$PACKAGE_NAME:Install_fails-------------------------------------"
6066
echo "$PACKAGE_URL $PACKAGE_NAME"
6167
echo "$PACKAGE_NAME | $PACKAGE_URL | $PACKAGE_VERSION | GitHub | Fail | Install_Fails"
@@ -70,16 +76,19 @@ echo "$PACKAGE_NAME | $PACKAGE_URL | $PACKAGE_VERSION | GitHub | Pass | Instal
7076
# Note: python setup.py test is deprecated in setuptools>=61.0
7177
# Using pytest instead
7278
pip3 install pytest
73-
if ! (pytest test/) ; then
74-
echo "------------------$PACKAGE_NAME:Install_success_but_test_fails---------------------"
75-
echo "$PACKAGE_URL $PACKAGE_NAME"
76-
echo "$PACKAGE_NAME | $PACKAGE_URL | $PACKAGE_VERSION | GitHub | Fail | Install_success_but_test_Fails"
77-
exit 2
78-
else
79-
echo "------------------$PACKAGE_NAME:Install_&_test_both_success-------------------------"
80-
echo "$PACKAGE_URL $PACKAGE_NAME"
81-
echo "$PACKAGE_NAME | $PACKAGE_URL | $PACKAGE_VERSION | GitHub | Pass | Both_Install_and_Test_Success"
82-
exit 0
79+
80+
if [ -d "test/" ]; then
81+
if ! pytest test/ ; then
82+
echo "------------------$PACKAGE_NAME:Install_success_but_test_fails---------------------"
83+
echo "$PACKAGE_URL $PACKAGE_NAME"
84+
echo "$PACKAGE_NAME | $PACKAGE_URL | $PACKAGE_VERSION | GitHub | Fail | Install_success_but_test_Fails"
85+
exit 2
86+
fi
8387
fi
8488

89+
echo "------------------$PACKAGE_NAME:Install_&_test_both_success-------------------------"
90+
echo "$PACKAGE_URL $PACKAGE_NAME"
91+
echo "$PACKAGE_NAME | $PACKAGE_URL | $PACKAGE_VERSION | GitHub | Pass | Both_Install_and_Test_Success"
92+
exit 0
93+
8594

0 commit comments

Comments
 (0)