-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfiguration.py
More file actions
104 lines (85 loc) · 2.22 KB
/
Copy pathconfiguration.py
File metadata and controls
104 lines (85 loc) · 2.22 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
# -*- coding: utf-8 -*-
import os
import shutil
import sys
import tempfile
class Mode:
def __init__(self, env=None, cmake=None, boost=None, suffix=None):
self.env = env or []
self.cmake = cmake or []
self.boost = boost or []
self.suffix = suffix or ''
ARGS = []
ACTIONS = []
## This is now used by the cmake build version
BOOST = [(None, None, None)]
OPTIONS = {'platform': None}
PROJECTS = {}
TARGETS = ['all', '']
MAKE = ['', 'install']
CMAKE = []
CMAKE_POST = ['-DSKIP_BUILD_TEST=ON']
VARIANTS = ['debug', 'release']
TOOLSET={
'clang': {
'env': ['CC=clang', 'CXX=clang++'],
},
'gcc': {}}
MODES = {
'clang': {
'': Mode(),
},
'gcc': {
'': Mode(),
}}
SKIP_TARGETS = set(['stress'])
def is_windows():
"""
Returns True if the system is Windows.
"""
return sys.platform == 'win32'
def execute(program, *args):
"""
Execute a program and return True if it worked.
"""
if is_windows():
program = program.replace('/', '\\')
command = '%s %s' % (program, ' '.join([str(a) for a in args]))
print('++ {}'.format(command))
return os.system(command) == 0
def worked(program, *args):
"""
Execute and make sure the command worked.
"""
assert execute(program, *args)
def git(directory, *args):
"""
Executed git in the requested directory relative to here.
"""
worked('cd', directory, '&&', 'git', *args)
def git_capture(directory, *args):
"""
Execute the git command and return it's output.
"""
args = list(args)
tmpdir = tempfile.mkdtemp()
filename = os.path.join(tmpdir, 'c.git.txt')
args.append("> %s" % (filename,))
git(directory, *args)
with open(filename) as f:
output = f.read()
shutil.rmtree(tmpdir)
print(output)
return output
def projects():
"""
A generator that iterates through the projects giving up the name, folder and configuration.
"""
for project, configuration in PROJECTS.items():
folder = configuration.get('folder', project)
yield (project, folder, configuration)
def platform(name):
"""
Set the platform name.
"""
OPTIONS['platform'] = name