-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit-dependence.py
More file actions
executable file
·40 lines (29 loc) · 993 Bytes
/
init-dependence.py
File metadata and controls
executable file
·40 lines (29 loc) · 993 Bytes
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
#! /usr/bin/env python3
import os
import os.path
import subprocess
SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__))
def main():
cmockery_dir = os.path.join(SCRIPT_DIR, 'third-party', 'cmockery')
libcmockery_dir = os.path.join(SCRIPT_DIR, 'third-party', 'libcmockery')
commands = [
(['git', 'clone', 'https://github.com/google/cmockery', cmockery_dir],
None, lambda: not os.path.exists(cmockery_dir)),
(['./configure'], cmockery_dir, None),
(['make'], cmockery_dir, None),
(['make', 'install', 'prefix=' + libcmockery_dir], cmockery_dir, None)
]
for cmd, cwd, cond in commands:
if not cond or cond():
check_call(cmd, cwd=cwd)
def check_call(*args, **kwargs):
p = subprocess.Popen(*args, **kwargs)
try:
r = p.wait()
except Exception as e:
p.terminate()
raise e
if r != 0:
raise subprocess.CalledProcessError()
if __name__ == '__main__':
main()