This repository has been archived by the owner on Jan 30, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable support for python repositories
- Loading branch information
1 parent
e83729c
commit b78ebcc
Showing
3 changed files
with
76 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
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 |
---|---|---|
|
@@ -5,3 +5,4 @@ cd $( dirname "${BASH_SOURCE[0]}" ) | |
./update-git.sh | ||
govuk_puppet | ||
./update-bundler.sh | ||
./update-pip.sh |
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,69 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
cd "$(dirname "$0")" | ||
|
||
ANSI_GREEN="\033[32m" | ||
ANSI_RED="\033[31m" | ||
ANSI_YELLOW="\033[33m" | ||
ANSI_RESET="\033[0m" | ||
ANSI_BOLD="\033[1m" | ||
|
||
ok () { | ||
start "$REPO" | ||
echo "${ANSI_GREEN}${@}${ANSI_RESET}" >&2 | ||
} | ||
|
||
error () { | ||
start "$REPO" | ||
echo "${ANSI_RED}${@}${ANSI_RESET}" >&2 | ||
} | ||
|
||
start () { | ||
local repo="$1" | ||
repo=$(truncate 25 "$repo") | ||
printf "${ANSI_BOLD}%-25s${ANSI_RESET} " "$repo" >&2 | ||
} | ||
|
||
truncate () { | ||
local len="$1" | ||
local str="$2" | ||
if [ "${#str}" -gt "$len" ]; then | ||
printf "$str" | awk "{ s=substr(\$0, 1, $len-3); print s \"...\"; }" | ||
else | ||
printf "$str" | ||
fi | ||
} | ||
|
||
DIRECTORY='.venv' | ||
|
||
find_pip_repos () { | ||
ls -d ../*/requirements.txt | cut -d/ -f2 | ||
} | ||
|
||
run_pip_install () { | ||
$DIRECTORY/bin/pip install -qr requirements.txt | ||
} | ||
|
||
for REPO in $(find_pip_repos) | ||
do | ||
cd "../$REPO" | ||
|
||
virtualenv -q "$DIRECTORY" | ||
|
||
if [ -f lock ]; then | ||
warn "skipped because 'lock' file exists" | ||
else | ||
echo "Updating $REPO..." | ||
outputfile=$(mktemp -t update-pip.XXXXXX) | ||
trap "rm -f '$outputfile'" EXIT | ||
|
||
if $(run_pip_install) >"$outputfile" 2>&1; then | ||
ok "ok" | ||
else | ||
error "failed with pip output:" | ||
cat "$outputfile" | ||
exit 1 | ||
fi | ||
fi | ||
done |