-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.sh
executable file
·54 lines (45 loc) · 1.11 KB
/
build.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
#!/bin/bash -e
# script to build & push pysofar to testing/production
pip="python3 -m pip"
usage() {
echo "$(basename $0) [--test|--prod]"
echo
echo "supply --test to push to test.pypi.org"
echo "supply --prod to push to production PyPI"
}
setup() {
${pip} install twine
python3 setup.py sdist bdist_wheel
}
testing() {
# For Test PyPi:
# https://packaging.python.org/en/latest/guides/using-testpypi/
#
setup
# password is an API token. search for test.pypi.org in password repository
twine upload --username __token__ --repository testpypi dist/*
${pip} install --index-url https://test.pypi.org/simple/ --no-deps --upgrade pysofar
}
production() {
# For production PyPi:
setup
twine upload dist/*
${pip} install --index-url https://test.pypi.org/legacy/ --no-deps pysofar
}
main() {
# execute testing or production according to user wishes
if [[ $1 = "--test" ]]
then
testing
elif [[ $1 = "--prod" ]]
then
production
else
usage
fi
}
# handle args
case $# in
1) main $1;;
*) usage; exit 1;;
esac