~benji/charms/precise/juju-gui/make-etags-ignore-inode

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
#!/bin/sh

# This file is part of the Juju GUI, which lets users view and manage Juju
# environments within a graphical interface (https://launchpad.net/juju-gui).
# Copyright (C) 2012-2013 Canonical Ltd.
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License version 3, as published by
# the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
# SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

TESTDIR=`dirname $0`
VENV="$TESTDIR/.venv"
ACTIVATE="$VENV/bin/activate"
TEST_REQUIREMENTS="test-requirements.pip"
SERVER_REQUIREMENTS="server-requirements.pip"


createvenv() {
    # Create a virtualenv if it does not exist, or it is older than requirements.
    retcode=0
    if [ ! -f "$ACTIVATE" -o "$TEST_REQUIREMENTS" -nt "$ACTIVATE" -o "$SERVER_REQUIREMENTS" -nt "$ACTIVATE" ]; then
        virtualenv --distribute $VENV
        . $ACTIVATE && \
            yes w | env BZR_PLUGIN_PATH='-user' \
            pip install --use-mirrors -r $TEST_REQUIREMENTS --find-links deps
        retcode=$?
        [ $retcode -eq 0 ] && touch $ACTIVATE || touch $TEST_REQUIREMENTS
    fi
    return $retcode
}


createvenv