annotate python/venvit2.py @ 355:93c8f28d485d

boo
author Jeff Hammel <jhammel@mozilla.com>
date Fri, 28 Jun 2013 10:26:54 -0700
parents
children 915f88af9624
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
355
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
1 #!/usr/bin/python
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
2
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
3 """
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
4 make a virtualenv for the product
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
5 """
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
6
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
7 import sys
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
8
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
9 # class for VCS
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
10 # TODO: hg, git, ...
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
11
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
12 # usage
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
13
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
14 args = sys.argv[1:]
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
15 if len(args) != 1:
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
16 print "Usage: %prog <svn-or-hg-location>"
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
17 fi
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
18
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
19 # determine name of the package
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
20 NAME=
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
21 for i in /trunk /branches /tag
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
22 do
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
23 NAME=${NAME%%$i*}
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
24 done
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
25 NAME=${NAME%%/} # remove trailing slash
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
26 NAME=${NAME##*/}
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
27
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
28 if svn info $1 2> /dev/null
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
29 then
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
30 CHECKOUT="svn co"
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
31 else
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
32 CHECKOUT="hg clone"
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
33 fi
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
34
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
35 # create a virtualenv and install the software
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
36 VIRTUAL_ENV_LOCATION="${HOME}/virtualenv/virtualenv.py"
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
37 python ${VIRTUAL_ENV_LOCATION} ${NAME}
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
38 cd ${NAME}
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
39 source bin/activate
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
40 mkdir src/
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
41 cd src/
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
42 $CHECKOUT $1 ${NAME}
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
43 cd ${NAME}
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
44 python setup.py develop