-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproject_boost.py
More file actions
112 lines (91 loc) · 2.43 KB
/
project_boost.py
File metadata and controls
112 lines (91 loc) · 2.43 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#! /usr/bin/env python
"""
NAME
{program_name} - {project_name} build actions script.
SYNOPSIS
{program_name} actions
DESCRIPTION
actions
{actions}
computed_env
{computed_env}
"""
import os, sys
import json
import pprint
import worktry
project_name = 'boost'
depends = {
'darwin': {
'projects':[],
'formulae':[],
},
}
envs = {
"default": {},
"darwin": {
},
}
computed_env = {}
def clean():
"""
clean action.
"""
if sys.platform != 'darwin':
raise NotImplementedError(sys.platform)
worktry.exec_cmd('cd {project_dir};'
'./b2 --clean'.format(**computed_env), computed_env)
def configure():
"""
configure action.
"""
if sys.platform != 'darwin':
raise NotImplementedError(sys.platform)
if os.path.exists('{project_dir}/b2') and os.path.exists('{project_dir}/project-config.jam'):
#project alrewady configured
# TODO verbose
return
worktry.exec_cmd('cd {project_dir};'
'./bootstrap.sh'.format(**computed_env), computed_env)
def distclean():
"""
distclean action.
"""
if sys.platform != 'darwin':
raise NotImplementedError(sys.platform)
worktry.exec_cmd('cd {project_dir};'
'rm -rf bjam b2 bin.v2 stage boost dist project-config.jam*'\
.format(**computed_env), computed_env)
def make():
"""
make action.
"""
if sys.platform != 'darwin':
raise NotImplementedError(sys.platform)
worktry.exec_cmd('cd {project_dir};'
'./b2 -j8'\
.format(**computed_env), computed_env)
def materialize():
"""
"""
worktry.materialize(project_name, computed_env)
computed_env.update(worktry.compute_project(project_name, depends, envs))
actions = {
'all': lambda: (configure(), make()),
'configure': configure,
'make': make,
'clean':clean,
'distclean':distclean,
'make_depends':lambda: None,
}
computed_env['actions'] = sorted(actions.keys())
computed_env['program_name'] = __file__
__doc__ = __doc__.format(computed_env=pprint.pformat(computed_env), **computed_env)
if __name__ == "__main__":
if len(sys.argv) != 2 or '-h' in sys.argv:
print(__doc__)
sys.exit(0)
action = sys.argv[1]
if action not in actions:
raise NotImplementedError('Action {}'.format(action))
actions[action]()