Mercurial > hg > buttercup
comparison buttercup/checkout.py @ 13:ac29f67b4a45
add an option to update the packages
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Mon, 08 Nov 2010 08:18:34 -0800 |
parents | 8a54d538646a |
children | 8c4f353e3c7c |
comparison
equal
deleted
inserted
replaced
12:d51923b276ef | 13:ac29f67b4a45 |
---|---|
44 | 44 |
45 # parse command line options | 45 # parse command line options |
46 parser = OptionParser() | 46 parser = OptionParser() |
47 parser.add_option('--install', action="store_true", default=False, | 47 parser.add_option('--install', action="store_true", default=False, |
48 help="install the packages") | 48 help="install the packages") |
49 parser.add_option('--update', action="store_true", default=False, | |
50 help="update the packages") | |
49 parser.add_option('--list', action="store_true", default=False, | 51 parser.add_option('--list', action="store_true", default=False, |
50 help="list the source to be installed") | 52 help="list the source to be installed") |
51 options, args = parser.parse_args(args) | 53 options, args = parser.parse_args(args) |
52 | 54 |
53 # list sources if specified | 55 # list sources if specified |
61 src = os.path.join(os.environ['VIRTUAL_ENV'], 'src') | 63 src = os.path.join(os.environ['VIRTUAL_ENV'], 'src') |
62 if not os.path.exists(src): | 64 if not os.path.exists(src): |
63 os.mkdir(src) | 65 os.mkdir(src) |
64 os.chdir(src) | 66 os.chdir(src) |
65 | 67 |
66 # clone the sources | 68 # clone othe sources |
67 for source in sources: | 69 for source in sources: |
68 if os.path.exists(source[0]): | 70 if os.path.exists(source[0]): |
69 print "%d already exists" | 71 if options.update: |
72 os.chdir(source[0]) | |
73 subprocess.call(['hg', 'pull']) | |
74 subprocess.call(['hg', 'update']) | |
75 os.chdir('..') | |
76 else: | |
77 print "%d already exists" | |
70 else: | 78 else: |
71 subprocess.call(['hg', 'clone', source[1]]) | 79 subprocess.call(['hg', 'clone', source[1]]) |
72 | 80 |
73 # install the sources | 81 # install the sources |
74 if options.install: | 82 if options.install: |