comparison python/venvit.py @ 358:0e270a448610

more partial work
author Jeff Hammel <jhammel@mozilla.com>
date Mon, 01 Jul 2013 21:41:23 -0700
parents 915f88af9624
children
comparison
equal deleted inserted replaced
357:b4e679b5a9c3 358:0e270a448610
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 21
22 import optparse
22 import sys 23 import sys
23 24
24 # class for VCS 25 # class for VCS
25 # TODO: hg, git, ... 26 # TODO: hg, git, ...
26 27
27 # usage 28 # usage
28 29
29 args = sys.argv[1:] 30 args = sys.argv[1:]
30 if len(args) != 1: 31 if len(args) != 1:
31 print "Usage: %prog <svn-or-hg-location>" 32 print "Usage: %prog <repo-location>"
32 33
33 34
34 # determine name of the package 35 # determine name of the package
35 NAME= 36 name = args[0]
36 for i in /trunk /branches /tag 37 for i in ('/trunk', '/branches', '/tag'):
37 do 38 if name.endswith(i):
38 NAME=${NAME%%$i*} 39 name = name[:-len(i)]
39 done 40
40 NAME=${NAME%%/} # remove trailing slash 41 NAME=${NAME%%/} # remove trailing slash
41 NAME=${NAME##*/} 42 NAME=${NAME##*/}
42 43
43 if svn info $1 2> /dev/null 44 if svn info $1 2> /dev/null
44 then 45 then