forked from houtianze/bypy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease.sh
executable file
·137 lines (117 loc) · 2.08 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#!/bin/sh
# !!! RUN THIS SCRIPT UNDER VIRTUALENV !!!
# need to run the following commands before running this release script
# (This is for macOS, and for python virtualenv is recommended)
# --------
# brew install pandoc
# pip3 install pandoc pypandoc twine pyflakes
### Usage ###
# - Testing: ./release.sh -buti
# - Actual: ./release.sh -abigtu
#set -o errexit
#set -x
trap "echo '=== Release script interrupted ==='; exit -1" SIGINT
check() {
command -v "$1" || { echo "'$1' doesn't exist, aborting."; exit -1; }
}
check git
check python
check pandoc
check pyflakes
check twine
check jq
pycmd=python
actual=0
build=0
install=0
upload=0
testit=0
tagit=0
parsearg() {
while getopts "abigtu" opt; do
case "$opt" in
a)
actual=1
;;
b)
build=1
;;
u)
upload=1
;;
i)
install=1
;;
t)
testit=1
;;
g)
tagit=1
;;
esac
done
}
runtest() {
eval $pycmd -m pyflakes bypy
eval $pycmd setup.py test
#eval $pycmd -m doctest -v bypy.py
eval $pycmd -m bypy -V
eval $pycmd -m bypy --config-dir bypy/test/configdir quota
}
installtest() {
# 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 --config-dir bypy/test/configdir quota
}
main() {
./syncver.sh
eval $pycmd genrst.py
parsearg $*
if [ "$actual" -eq 0 ]
then
repoopt="-r testpypi"
indexopt="-i https://testpypi.python.org/simple/"
else
repoopt=""
indexopt=""
fi
if [ "$tagit" -eq 1 ]
then
bypyversion=`grep __version__ bypy/const.py | sed -e "s/__version__ *= *'//g" -e "s/'//g"`
git tag
git tag "$bypyversion"
git push
git push --tags
git tag
fi
if [ "$testit" -eq 1 ]
then
runtest
fi
if [ "$build" -eq 1 ]
then
rm -Rf dist/*
eval $pycmd 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
fi
}
main $*
# vim: tabstop=4 noexpandtab shiftwidth=4 softtabstop=4 ff=unix fileencoding=utf-8