PageRenderTime 5ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/src/pyechonest/mkrelease.sh

http://echo-nest-remix.googlecode.com/
Shell | 68 lines | 43 code | 13 blank | 12 comment | 9 complexity | 8945a5f578508382a4c841e0ad4127dd MD5 | raw file
 1#!/bin/bash
 2
 3# ==============================================
 4# = This script will make a pyechonest release =
 5# ==============================================
 6
 7args=`getopt to: $*`
 8
 9function usage() {
10    echo "$0 -o <build result> [-t <temp work dir>]"
11}
12
13if [ $? != 0 ]; then
14        usage
15        exit 2
16fi
17
18EXPORT_LOCATION=""
19TEMP_LOCATION="/tmp/pyechonest"
20set -- $args
21for i
22do
23    case "$i" in
24        -o)
25            EXPORT_LOCATION=$2; shift;
26            shift;;
27        -t)
28            TEMP_LOCATION=$2; shift;
29            shift;;
30        --)
31            shift; break;;
32    esac
33done
34
35if [ -z "${EXPORT_LOCATION}" ]; then
36    usage
37    exit 2
38fi
39
40# check that sphinx is installed, we need it to make the docs!
41type -P sphinx-build &>/dev/null || { echo "Please install sphinx (easy_install -U sphinx)" >&2; exit 1; }
42# export a clean copy to export location
43svn export . "$TEMP_LOCATION"
44
45# remove this script, as well as our test files or .pyc files
46rm -rf "$TEMP_LOCATION"/mkrelease.sh
47rm -rf "$TEMP_LOCATION"/test.py
48rm -rf "$TEMP_LOCATION"/test
49rm -rf "$TEMP_LOCATION"/tmp
50
51# remake the docs
52cd "$TEMP_LOCATION" && \
53    python "$TEMP_LOCATION"/setup.py build_sphinx
54
55# remove pyc files
56find "$TEMP_LOCATION" -name "*.pyc" | xargs rm -rf
57
58# make zip and copy
59cd "$TEMP_LOCATION" && \
60    zip -r "$EXPORT_LOCATION"/pyechonest.zip .
61
62# make egg and copy
63cd "$TEMP_LOCATION" && \
64    python "$TEMP_LOCATION"/setup.py bdist_egg && \
65    cp dist/*.egg "$EXPORT_LOCATION"
66
67# remove temp dir
68rm -rf "$TEMP_LOCATION"