-
Notifications
You must be signed in to change notification settings - Fork 2
/
b2code-option-externals.py
42 lines (33 loc) · 1.45 KB
/
b2code-option-externals.py
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
# -*- coding: utf-8 -*-
from __future__ import print_function
import textwrap
from setup_tools import update_environment, SetupToolsArgumentParser
# allowed options
options = ['debug', 'opt', 'intel']
def get_argument_parser():
description = textwrap.dedent('''
Set up the environment for selected compiler options for the externals:
debug : include debug symbols, no optimization
opt : turn on optimization (-O3), no debug symbols
intel : use the intel compiler
''')
parser = SetupToolsArgumentParser(prog='b2code-option-externals',
description=description,
state_env_var='BELLE2_EXTERNALS_OPTION')
parser.add_argument('option',
metavar='OPTION',
type=str,
choices=options,
help='Environment for the compiler option')
parser.add_argument('--csh',
default=False,
action='store_true',
help='To be used with csh shells.')
return parser
if __name__ == '__main__':
args = get_argument_parser().parse_args()
# update environment with new externals option
update_environment(externals_option=args.option,
csh=args.csh)
# inform user about successful completion
print('echo "Environment setup for externals option: ${BELLE2_EXTERNALS_OPTION}"')