PageRenderTime 173ms CodeModel.GetById 131ms app.highlight 4ms RepoModel.GetById 37ms app.codeStats 0ms

/silverlining/create-zip.sh

https://bitbucket.org/ianb/silverlining/
Shell | 61 lines | 44 code | 8 blank | 9 comment | 8 complexity | 7cf5820f5fbadb965efb9d5114aae8ab MD5 | raw file
 1#!/usr/bin/env bash
 2# This script creates the zip file that is a runnable version of silverlining.
 3# Usage:
 4#   create-zip.sh
 5# You may set these environmental variables to control it:
 6#   $BUILD_DIR: place to put the zip file
 7#   $VIRTUALENV: location of a virtualenv.py script
 8#   $VERSION: version to build
 9#   $ZIP_DIR: place to put the zip file
10
11pushd "$(dirname $BASH_SOURCE)/../"
12if [ -z "$VERSION" ] ; then
13    VERSION="$(python setup.py --version)"
14fi
15
16if [ -z "$BUILD_DIR" ] ; then
17    BUILD_DIR="zip-build"
18fi
19
20mkdir -p $BUILD_DIR
21BUILD="$BUILD_DIR/silverlining-$VERSION"
22
23if [ "$VIRTUALENV" = "" ] ; then
24    VIRTUALENV="virtualenv"
25fi
26
27if [ -e "$BUILD" ] ; then
28    rm -rf $BUILD
29fi
30
31$VIRTUALENV -p python2.6 $BUILD
32
33$BUILD/bin/pip install \
34  http://bitbucket.org/ianb/cmdutils/get/tip.gz#egg=cmdutils \
35  https://svn.apache.org/repos/asf/incubator/libcloud/trunk/#egg=libcloud \
36  simplejson \
37  -e .
38$BUILD/bin/python setup.py install --single-version-externally-managed --record $BUILD_DIR/record.txt
39
40cp silverlining/silverlining-zip-command.py $BUILD/silverlining.py
41chmod +x $BUILD/silverlining.py
42mv $BUILD/lib/python2.6/site-packages $BUILD/lib.tmp
43rm -r $BUILD/lib
44mv $BUILD/lib.tmp $BUILD/lib
45rm -rf $BUILD/bin $BUILD/include $BUILD/build
46rm -r $BUILD/lib/pip-*.egg/ $BUILD/lib/setuptools.pth $BUILD/lib/setuptools-*.egg $BUILD/lib/easy-install.pth
47find $BUILD -name '*.pyc' -exec rm {} \;
48pushd $BUILD_DIR
49if [ -z "$ZIP_DIR" ] ; then
50    ZIP_DIR="."
51fi
52F="$ZIP_DIR/silverlining-${VERSION}.zip"
53zip -r $F silverlining-${VERSION}
54if [ -d ../dist ] ; then
55    mv $F ../dist
56else 
57    if [ -d ../../dist ] ; then
58        mv $F ../../dist
59    fi
60fi
61popd