Mercurial > hg > config
comparison python/venvit.py @ 356:915f88af9624
transition
| author | Jeff Hammel <jhammel@mozilla.com> |
|---|---|
| date | Fri, 28 Jun 2013 10:32:21 -0700 |
| parents | a9110cc98d94 |
| children | 0e270a448610 |
comparison
equal
deleted
inserted
replaced
| 355:93c8f28d485d | 356:915f88af9624 |
|---|---|
| 16 | 16 |
| 17 Ideally, packages could have a venvit__init__.py (or a better name) that | 17 Ideally, packages could have a venvit__init__.py (or a better name) that |
| 18 will be executed after installation (or a venvit.txt which would just be output | 18 will be executed after installation (or a venvit.txt which would just be output |
| 19 to console, maybe falling back to the README | 19 to console, maybe falling back to the README |
| 20 """ | 20 """ |
| 21 | |
| 22 import sys | |
| 23 | |
| 24 # class for VCS | |
| 25 # TODO: hg, git, ... | |
| 26 | |
| 27 # usage | |
| 28 | |
| 29 args = sys.argv[1:] | |
| 30 if len(args) != 1: | |
| 31 print "Usage: %prog <svn-or-hg-location>" | |
| 32 | |
| 33 | |
| 34 # determine name of the package | |
| 35 NAME= | |
| 36 for i in /trunk /branches /tag | |
| 37 do | |
| 38 NAME=${NAME%%$i*} | |
| 39 done | |
| 40 NAME=${NAME%%/} # remove trailing slash | |
| 41 NAME=${NAME##*/} | |
| 42 | |
| 43 if svn info $1 2> /dev/null | |
| 44 then | |
| 45 CHECKOUT="svn co" | |
| 46 else | |
| 47 CHECKOUT="hg clone" | |
| 48 fi | |
| 49 | |
| 50 # create a virtualenv and install the software | |
| 51 VIRTUAL_ENV_LOCATION="${HOME}/virtualenv/virtualenv.py" | |
| 52 python ${VIRTUAL_ENV_LOCATION} ${NAME} | |
| 53 cd ${NAME} | |
| 54 source bin/activate | |
| 55 mkdir src/ | |
| 56 cd src/ | |
| 57 $CHECKOUT $1 ${NAME} | |
| 58 cd ${NAME} | |
| 59 python setup.py develop |
