-
Notifications
You must be signed in to change notification settings - Fork 876
/
mkrelease.sh
executable file
·70 lines (57 loc) · 1.66 KB
/
mkrelease.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
#!/bin/bash
# ==============================================
# = This script will make a pyechonest release =
# ==============================================
args=`getopt to: $*`
function usage() {
echo "$0 -o <build result> [-t <temp work dir>]"
}
if [ $? != 0 ]; then
usage
exit 2
fi
EXPORT_LOCATION=""
TEMP_LOCATION="/tmp"
set -- $args
for i
do
case "$i" in
-o)
EXPORT_LOCATION=$2; shift;
shift;;
-t)
TEMP_LOCATION=$2; shift;
shift;;
--)
shift; break;;
esac
done
if [ -z "${EXPORT_LOCATION}" ]; then
usage
exit 2
fi
# check that sphinx is installed, we need it to make the docs!
type -P sphinx-build &>/dev/null || { echo "Please install sphinx (easy_install -U sphinx)" >&2; exit 1; }
# export a clean copy to export location
git archive master --format tar --prefix pyechonest/ --output $TEMP_LOCATION/pyechonest.tar.gz
tar -xvzf $TEMP_LOCATION/pyechonest.tar.gz -C $TEMP_LOCATION/
# remove this script, as well as our test files or .pyc files
rm -rf "$TEMP_LOCATION"/mkrelease.sh
rm -rf "$TEMP_LOCATION"/test.py
rm -rf "$TEMP_LOCATION"/test
rm -rf "$TEMP_LOCATION"/tmp
# remake the docs
cd "$TEMP_LOCATION"/pyechonest && \
python setup.py build_sphinx
# remove pyc files
find "$TEMP_LOCATION"/pyechonest -name "*.pyc" | xargs rm -rf
# make zip and copy
cd "$TEMP_LOCATION" && \
zip -r "$EXPORT_LOCATION"/pyechonest.zip pyechonest
# make egg and copy
cd "$TEMP_LOCATION"/pyechonest && \
python setup.py bdist_egg && \
cp dist/*.egg "$EXPORT_LOCATION"
# remove temp dir
rm -rf "$TEMP_LOCATION"/pyechonest
rm -rf "$TEMP_LOCATION"/pyechonest.tar.gz