-
Notifications
You must be signed in to change notification settings - Fork 6
/
configure
executable file
·43 lines (33 loc) · 1.59 KB
/
configure
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
#!/usr/bin/env python
import argparse
import os
import subprocess
import json
import pipes
project_root = os.path.dirname(os.path.abspath(__file__))
os.chdir(project_root)
needy = os.path.join(project_root, 'needy', 'scripts', 'needy')
def generate_needy_files(common_args, satisfy_args):
subprocess.check_call(
'{needy} generate pkgconfig-jam jamfile --satisfy-args="{common_args} {satisfy_args}" {common_args}'.format(
needy=needy,
common_args=common_args,
satisfy_args=satisfy_args
), shell=True)
configuration = {}
config_file = 'configure.json'
if os.path.exists(config_file):
print('Reading configuration from {}'.format(config_file))
with open(config_file, 'r') as configure_json:
configuration = json.loads(configure_json.read())
parser = argparse.ArgumentParser(description='Configures the library.')
parser.add_argument('--needy-satisfy-args',
default=' '.join([pipes.quote(s) for s in configuration.get('needy', {}).get('satisfy-args', [])]),
help='the arguments to pass on to needy satisfy')
parser.add_argument('--needy-common-args',
default=' '.join([pipes.quote(s) for s in configuration.get('needy', {}).get('common-args', [])]),
help='the common arguments to pass to needy (including satisfy)')
args = parser.parse_args()
os.environ.update(configuration.get('env', {}))
generate_needy_files(args.needy_common_args, args.needy_satisfy_args)
print('Configuration complete. You may now build via {}.'.format('./b2' if os.path.exists('b2') else 'b2'))