forked from jjhesk/tronpytool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update
79 lines (68 loc) · 2.22 KB
/
update
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
#!/usr/bin/env bash
# Accepts a version string and prints it incremented by one.
# Usage: increment_version <version> [<position>] [<leftmost>]
increment_version() {
declare -a part=(${1//\./ })
declare new
declare -i carry=1
for ((CNTR = ${#part[@]} - 1; CNTR >= 0; CNTR -= 1)); do
len=${#part[CNTR]}
new=$((part[CNTR] + carry))
[ ${#new} -gt $len ] && carry=1 || carry=0
[ $CNTR -gt 0 ] && part[CNTR]=${new: -len} || part[CNTR]=${new}
done
new="${part[*]}"
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
echo -e "${new// /.}"
elif [[ "$OSTYPE" == "darwin"* ]]; then
echo "${new// /.}"
elif [[ "$OSTYPE" == "cygwin" ]]; then
echo "not correct system - cygwin detected"
exit
fi
}
clean_publish_pypi() {
VERSION=$(cat version)
increment_version $VERSION >version
VERSION=$(cat version)
sudo rm -rf dist
rm -rf html
rm -rf doc
python3 -m pdoc --html tronpytool
mv html/tronpytool docs/tronpytool
rm html
python3 -m pip install --user --upgrade setuptools wheel
# python3 -m pip install --upgrade setuptools wheel
sudo python3 setup.py clean sdist bdist_wheel
# python3 -m pip install --user --upgrade twine
# python3 -m twine upload --repository testpypi dist/*
python3 -m twine upload dist/* --verbose
echo "please update the package by using this command"
echo "pip3 install tronpytool==$VERSION"
echo "pi tronpytool==$VERSION"
echo "pc tronpytool==$VERSION"
echo "sudo pip3 install tronpytool==$VERSION --upgrade"
echo "wait 30 seconds until it gets uploaded online..."
# echo "ready and install it again.."
# sudo pip3 install --proxy 127.0.0.1:1087 tronpytool==$VERSION
}
git_update() {
git add .
# git remote add origin https://gitee.com/jjhoc/tronpytool.git
git commit -m "package updates related items. please check in commit details"
#git remote add origin https://gitee.com/jjhoc/b-explorer-settings.git
git push origin
git push github
}
swap_src() {
local DEV_SRC=$HOME/Documents/b95/devtron/tronpytool
local DEPLOY_SRC=$HOME/Documents/piplines/tron-tool-py/tronpytool
if [[ -d "$DEV_SRC" ]]; then
echo "now swapping the source code"
rm -rf tronpytool
cp -R $DEV_SRC $DEPLOY_SRC
fi
}
#swap_src
#clean_publish_pypi
git_update