]> git.phdru.name Git - git-scripts.git/blob - add-pubkey/post-checkout
Exclude .tox/ virtual environments when compiling byte code
[git-scripts.git] / add-pubkey / post-checkout
1 #!/bin/sh
2
3 # post-checkout hook that compiles python files to byte code
4 # if branch was changed or removes byte code files for a specific branch
5
6 prev_HEAD="$1"
7 new_HEAD="$2"
8 new_branch="$3"
9
10 if [ \( "$new_branch" = 1 \) ]; then
11    if [ "$new_HEAD" = "`git rev-parse phd-pubkey`" ]; then
12       git clean -d -f -q
13    else
14       python    -m compileall -q -x '\.tox/.+' . &&
15       python -O -m compileall -q -x '\.tox/.+' .
16    fi
17 fi
18
19 exit 0