-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpublish.sh
executable file
·44 lines (34 loc) · 917 Bytes
/
publish.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
#!/usr/bin/env bash
set -e
function clean_build_dirs {
rm -rf ./build > /dev/null 2>&1
rm -rf ./dist > /dev/null 2>&1
rm -rf ./worker_bunch.egg-info > /dev/null 2>&1
}
# change into script dir to use relative paths
SCRIPT_PATH=$(readlink -f $0)
SCRIPT_DIR=$(dirname "$SCRIPT_PATH")
SCRIPT_NAME=$(basename $0)
cd "$SCRIPT_DIR"
export PYTHONPATH="$SCRIPT_DIR"
export PYTHONUNBUFFERED=1
if [[ "$VIRTUAL_ENV" != "" ]] ; then
# no active virtual env => activate it
VENV_ACTIVATE="./venv/bin/activate"
if [ ! -f "$VENV_ACTIVATE" ] ; then
echo -e "$SCRIPT_NAME\nerror: venv environment doesn't exist!"
exit 1
fi
source "$VENV_ACTIVATE"
RC=$?
if [ $RC -ne 0 ] ; then
echo -e "$SCRIPT_NAME\nerror: activating environment failed!"
exit 1
fi
fi
clean_build_dirs
python setup.py sdist bdist_wheel
python -m twine upload --repository pypi dist/*
clean_build_dirs
echo "done"
exit 0