-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake_project
More file actions
executable file
·31 lines (22 loc) · 884 Bytes
/
Copy pathmake_project
File metadata and controls
executable file
·31 lines (22 loc) · 884 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
#!/usr/bin/env python3
import argparse
import sys
import os
from subprocess import check_call
PROJ = 'make_project_impl.sh'
def run_script(name, **kwargs):
here = os.path.dirname(__file__)
shell(os.path.join(here, name), **kwargs)
def shell(cmd, **kwargs):
"""We're gonna run shell scripts anyway, so we might as well"""
return check_call(cmd, shell=True, **kwargs)
if __name__ == '__main__':
p = argparse.ArgumentParser()
p.add_argument('--cpp', action='store_true', help='C++ project')
p.add_argument('--py', action='store_true', help='Python project')
p.add_argument('name', help='Project path, e.g. /tmp/my_project')
args = p.parse_args()
if args.cpp:
run_script(f'{PROJ} {args.name}', env={**os.environ.copy(), 'CPP': '1'})
elif args.py:
run_script(f'{PROJ} {args.name}', env={**os.environ.copy(), 'PY': '1'})