forked from houtianze/bypy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
executable file
·118 lines (101 loc) · 1.55 KB
/
release.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!/bin/sh
#set -o errexit
#set -x
py2venv="$HOME/Documents/t/venv27"
py3venv="$HOME/Documents/t/venv34"
actual=0
build=0
install=0
upload=0
testit=0
createvenv() {
if [ ! -d "$py2venv" ]
then
python2 -m virtualenv "$py2venv"
fi
if [ ! -d "$py3venv" ]
then
python3 -m virtualenv "$py3venv"
fi
}
parsearg() {
while getopts "abuit" opt; do
case "$opt" in
a)
actual=1
;;
b)
build=1
;;
u)
upload=1
;;
i)
install=1
;;
t)
testit=1
;;
esac
done
}
doctest() {
eval $1 -m pyflakes bypy
eval $1 setup.py test
#eval $1 -m doctest -v bypy.py
}
installtest() {
. "$1"
# due to requests not in testpypi
if [ $actual -eq 0 ]
then
pip install requests
else
pip uninstall -y requests
fi
pip uninstall -y bypy
pip install -U bypy $indexopt
bypy -V
bypy quota
deactivate
}
main() {
#if [ ! -f 'HISTORY.rst' ]; then
# python genrst.py
#fi
python genrst.py
createvenv
parsearg $*
if [ "$actual" -eq 0 ]
then
repoopt="-r testpypi"
indexopt="-i https://testpypi.python.org/simple/"
else
repoopt=""
indexopt=""
fi
if [ "$testit" -eq 1 ]
then
doctest python2
doctest python3
fi
if [ "$build" -eq 1 ]
then
rm -Rf dist/*
python setup.py bdist_wheel #sdist
fi
uploadcmd="twine upload dist/* $repoopt"
if [ "$upload" -eq 0 ]
then
echo "$uploadcmd"
else
eval "$uploadcmd"
fi
if [ "$install" -eq 1 ]
then
installtest "$py2venv/bin/activate"
installtest "$py3venv/bin/activate"
fi
}
main $*
# vim: tabstop=4 noexpandtab shiftwidth=4 softtabstop=4 ff=unix fileencoding=utf-8