Last active
September 13, 2018 03:37
-
-
Save chrissimpkins/a0190de3e93ba7698c5895fa3b3a2df4 to your computer and use it in GitHub Desktop.
cache-py.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
#----------------------------------- | |
## put in an after job | |
## bash ./cache-py.sh 3.7.0 | |
#----------------------------------- | |
py_ver=${1:-'3.7.0'} | |
py_dir="py$py_ver" | |
py_path="$SEMAPHORE_CACHE_DIR/$py_dir" | |
py_archive="$SEMAPHORE_CACHE_DIR/py$py_ver-cache.tar.gz" | |
if [ -d $py_path ]; then | |
echo "Removing old archive..." | |
rm -f $py_archive | |
echo "Creating new archive ..." | |
tar -czf $py_archive -C $SEMAPHORE_CACHE_DIR $py_dir | |
echo "Removing Python $py_ver dir..." | |
rm -rf $py_path | |
echo "Done." | |
else | |
echo "No Python $py_ver installation cache found. Skipping compressing." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment