-
Notifications
You must be signed in to change notification settings - Fork 40
/
create-environment
executable file
·61 lines (46 loc) · 1.63 KB
/
create-environment
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env python2.7
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import argparse
import os
import sys
HERE = os.path.abspath(os.path.dirname(__file__))
sys.path.insert(0, os.path.join(HERE, 'testing'))
from vcttesting.environment import (
create_docs,
create_global,
create_hgdev,
)
def main():
parser = argparse.ArgumentParser()
subparsers = parser.add_subparsers(title='environment', dest='environment')
sp = subparsers.add_parser('docs',
help='Generate documentation')
sp = subparsers.add_parser('hgdev',
help='Mercurial hooks and extensions')
sp = subparsers.add_parser('test',
help='Mercurial extensions and server environment')
args = parser.parse_args()
env = args.environment
if env == 'docs':
info = create_docs()
elif env == 'hgdev':
info = create_hgdev()
elif env in 'test':
info = create_global()
else:
raise Exception('unhandled environment: %s' % env)
print('%s environment created successfully.' % env)
print('')
print('To activate this environment, source a shell script:')
print('')
print(' $ source %s' % os.path.relpath(info['activate'], HERE))
print('')
print('To update the environment, just run this command again.')
print('')
print('To run tests relevant to this environment:')
print('')
print(' $ ./run-tests')
if __name__ == '__main__':
main()