-
Notifications
You must be signed in to change notification settings - Fork 0
/
devutils.sh
executable file
·59 lines (47 loc) · 1.51 KB
/
devutils.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash -eux
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve until $SOURCE is not a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative
# symlink, need to resolve it
# relative to the path where
# the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
alias virtenv=pyenv
alias virtpip=pip3
alias virtpy=python3
VIRTENV="$(virtenv version)"
VIRTPIP="$(virtpip --version)"
VIRTPY="$(virtpy --version)"
echo "VIRTENV=${VIRTENV}"
echo "VIRTPIP=${VIRTPIP}"
echo "VIRTPY=${VIRTPY}"
function devinit(){
echo "[bray] VIRTENV=${VIRTENV}"
echo "[bray] VIRTPIP=${VIRTPIP}"
echo "[bray] VIRTPY=${VIRTPY}"
pushd "${DIR}" >/dev/null
echo "[bray] base directory: $(pwd)"
echo -n "[bray] python version: " && virtpy --version
echo -n "[bray] pip version: " && virtpip --version
echo
echo pip install --upgrade pip setuptools build
echo pip install tox tox-pyenv
popd >/dev/null
}
function devclean(){
pushd "${DIR}"
echo $(pwd)
echo rm -rf build/
echo rm -rf dist/
echo rm -rf htmlcov/
echo rm -f coverage.xml
echo rm -rf src/*.egg-info
echo python setup.py clean --all
popd
}
unalias virtenv
unalias virtpip
unalias virtpy