-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.sh
executable file
·70 lines (65 loc) · 1.74 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env bash
# Fail on error
set -e
VIRTUAL_ENV_PATH="venv"
function print_help() {
echo ""
echo "Utility script for building and publishing package"
echo ""
echo "Usage: build command1"
echo ""
echo "Positional arguments"
echo "command Command to run. Available options are: clean, build, publish"
echo ""
}
if [[ -z SKIP_VENV ]]; then
source "${VIRTUAL_ENV_PATH}/bin/activate"
else
echo "Virtual environment is disabled. Continue with system global context."
fi
if [[ $# -eq 0 ]]; then
print_help
exit 1
fi
while [[ $# -gt 0 ]]
do
command="$1"
module="setup.py"
case $command in
clean)
echo "Cleaning build output dirs"
rm -rf src/build
rm -rf dist/*
rm -rf *.egg-info
rm -rf src/*.egg-info
;;
build)
echo "Applying copyright..."
./development/copyright-update
echo "done"
echo "Building wheel package..."
bash -c "cd src && python ./$module bdist_wheel --dist-dir=../dist --bdist-dir=../../build"
echo "done"
echo "Building source distribution..."
bash -c "cd src && python ./$module sdist --dist-dir=../dist"
echo "done"
;;
build-client)
module="client_setup.py"
echo "Applying copyright..."
./development/copyright-update
echo "done"
echo "Building wheel package..."
bash -c "cd src && python ./$module bdist_wheel --dist-dir=../dist --bdist-dir=../../build"
echo "done"
;;
publish)
echo "Uploading packages on PyPi"
twine upload -r pypi dist/*
;;
*)
echo "ERROR: Unknown command: $command."
exit 1
esac
shift
done