-
Notifications
You must be signed in to change notification settings - Fork 835
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
script to update python versions in docs, Makefiles and notebooks aut…
…omatically
- Loading branch information
1 parent
c646c52
commit 0f31846
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -o nounset | ||
set -o errexit | ||
set -o pipefail | ||
|
||
STARTUP_DIR="$( cd "$( dirname "$0" )" && pwd )" | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
adriangonz
Contributor
|
||
|
||
if [ "$#" -ne 2 ]; then | ||
echo "You must enter <existing-python-version> <new-python-version>" | ||
exit 1 | ||
fi | ||
|
||
OLD_VERSION=$1 | ||
NEW_VERSION=$2 | ||
|
||
declare -a paths=('./examples/*.ipynb' './docs/*.md' './example/*Makefile' './integrations/*Makefile') | ||
declare -a versions=('2' '3' '36' '37') | ||
|
||
cd ../../.. | ||
|
||
for i in "${paths[@]}" | ||
do | ||
for PYTHON_VERSION in "${versions[@]}" | ||
do | ||
echo "Updating python version ${PYTHON_VERSION} in $i from ${OLD_VERSION} to ${NEW_VERSION}" | ||
find . -type f -path "$i" -exec grep -l seldon-core-s2i-python${PYTHON_VERSION}:${OLD_VERSION} \{\} \; | xargs -n1 -r sed -i "s/seldon-core-s2i-python${PYTHON_VERSION}:${OLD_VERSION}/seldon-core-s2i-python${PYTHON_VERSION}:${NEW_VERSION}/g" | ||
done | ||
done | ||
|
||
|
||
|
Wouldn't just
STARTUP_DIR="$PWD"
be good enough?