forked from yuppity/unifi-video-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtopypi.bash
47 lines (37 loc) · 755 Bytes
/
topypi.bash
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
#!/usr/bin/env bash
PKG_NAME="$(sed -n 's/.*pypi_package_name *= *["'"'"']\(.*\)["'"'"'].*/\1/p' setup.py)"
DIST_DIR=_dist_"${PKG_NAME}"
clean() {
(
shopt -s globstar
rm -r **/__pycache__/
rm **/*.pyc
)
rm -rfv "${DIST_DIR}"
rm -rfv "${PKG_NAME//-/_}".egg-info
}
build_dist() {
python3 setup.py sdist --dist-dir "${DIST_DIR}"
}
upload() {
if [ ! -z $1 ]; then
python3 -m twine upload --repository-url https://test.pypi.org/legacy/ "${DIST_DIR}"/*.tar.gz
else
python3 -m twine upload "${DIST_DIR}"/*.tar.gz
fi
}
case $1 in
test)
clean && build_dist && upload totest
clean
;;
build)
clean && build_dist
;;
clean)
clean
;;
*)
clean && build_dist && upload
clean
esac