annotate bin/venvit.sh @ 294:a0d830fd8a42

refactor this bad boy
author Jeff Hammel <jhammel@mozilla.com>
date Sat, 11 May 2013 03:49:06 -0700
parents 6463a7e37c45
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
1 #!/bin/bash
52
ac08d765aa32 allow cloning from hg instead of just svn
Jeff Hammel <k0scist@gmail.com>
parents: 0
diff changeset
2 # make a virtualenv for the product
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
3
52
ac08d765aa32 allow cloning from hg instead of just svn
Jeff Hammel <k0scist@gmail.com>
parents: 0
diff changeset
4 # usage
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
5 if (( $# != 1 ))
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
6 then
52
ac08d765aa32 allow cloning from hg instead of just svn
Jeff Hammel <k0scist@gmail.com>
parents: 0
diff changeset
7 echo "Usage: $0 <svn-or-hg-location>"
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
8 exit 0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
9 fi
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
10
52
ac08d765aa32 allow cloning from hg instead of just svn
Jeff Hammel <k0scist@gmail.com>
parents: 0
diff changeset
11 # determine name of the package
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
12 NAME=$1
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
13 for i in /trunk /branches /tag
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
14 do
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
15 NAME=${NAME%%$i*}
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
16 done
105
6463a7e37c45 account for trailing slash
Jeff Hammel <jhammel@mozilla.com>
parents: 52
diff changeset
17 NAME=${NAME%%/} # remove trailing slash
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
18 NAME=${NAME##*/}
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
19
52
ac08d765aa32 allow cloning from hg instead of just svn
Jeff Hammel <k0scist@gmail.com>
parents: 0
diff changeset
20 if svn info $1 2> /dev/null
ac08d765aa32 allow cloning from hg instead of just svn
Jeff Hammel <k0scist@gmail.com>
parents: 0
diff changeset
21 then
ac08d765aa32 allow cloning from hg instead of just svn
Jeff Hammel <k0scist@gmail.com>
parents: 0
diff changeset
22 CHECKOUT="svn co"
ac08d765aa32 allow cloning from hg instead of just svn
Jeff Hammel <k0scist@gmail.com>
parents: 0
diff changeset
23 else
ac08d765aa32 allow cloning from hg instead of just svn
Jeff Hammel <k0scist@gmail.com>
parents: 0
diff changeset
24 CHECKOUT="hg clone"
ac08d765aa32 allow cloning from hg instead of just svn
Jeff Hammel <k0scist@gmail.com>
parents: 0
diff changeset
25 fi
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
26
52
ac08d765aa32 allow cloning from hg instead of just svn
Jeff Hammel <k0scist@gmail.com>
parents: 0
diff changeset
27 # create a virtualenv and install the software
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
28 VIRTUAL_ENV_LOCATION="${HOME}/virtualenv/virtualenv.py"
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
29 python ${VIRTUAL_ENV_LOCATION} ${NAME}
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
30 cd ${NAME}
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
31 source bin/activate
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
32 mkdir src/
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
33 cd src/
52
ac08d765aa32 allow cloning from hg instead of just svn
Jeff Hammel <k0scist@gmail.com>
parents: 0
diff changeset
34 $CHECKOUT $1 ${NAME}
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
35 cd ${NAME}
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
36 python setup.py develop