Skip to content

Commit 30bd9da

Browse files
committed
Check for the case where less cython file has been deleted
1 parent aaf4dd2 commit 30bd9da

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

ci/prep_cython_cache.sh

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,22 @@ ls "$HOME/.cache/"
44

55
PYX_CACHE_DIR="$HOME/.cache/pyxfiles"
66
pyx_file_list=`find ${TRAVIS_BUILD_DIR} -name "*.pyx"`
7+
pyx_cache_file_list=`find ${PYX_CACHE_DIR} -name "*.pyx"`
8+
79
CACHE_File="$HOME/.cache/cython_files.tar"
810

11+
# Clear the cython cache 0 = NO, 1 = YES
912
clear_cache=0
13+
14+
pyx_files=`echo "$pyx_file_list" | wc -l`
15+
pyx_cache_files=`echo "$pyx_cache_file_list" | wc -l`
16+
17+
if [[ pyx_files -ne pyx_cache_files ]]
18+
then
19+
echo "Different number of pyx files"
20+
clear_cache=1
21+
fi
22+
1023
home_dir=$(pwd)
1124

1225
if [ -f "$CACHE_File" ] && [ "$USE_CACHE" ] && [ -d "$PYX_CACHE_DIR" ]; then
@@ -44,17 +57,17 @@ if [ -f "$CACHE_File" ] && [ "$USE_CACHE" ] && [ -d "$PYX_CACHE_DIR" ]; then
4457

4558
fi
4659

47-
if [ $clear_cache -eq 1 ] && [ "$USE_CACHE" ]
60+
if [ $clear_cache -eq 0 ] && [ "$USE_CACHE" ]
4861
then
49-
# nope, reuse cython files
62+
# No and use_cache is set
5063
echo "Will reuse cached cython file"
5164
cd /
5265
tar xvmf $CACHE_File
5366
cd $home_dir
5467
else
5568
echo "Rebuilding cythonized files"
56-
echo "Use cache = $USE_CACHE"
57-
echo "Clear cache = $clear_cache"
69+
echo "Use cache (Blank if not set) = $USE_CACHE"
70+
echo "Clear cache (1=YES) = $clear_cache"
5871
fi
5972

6073

0 commit comments

Comments
 (0)