forked from floooh/fips
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.py
42 lines (37 loc) · 1.37 KB
/
build.py
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
"""build fips project
build
build [config]
"""
from mod import log, util, project, settings
#-------------------------------------------------------------------------------
def run(fips_dir, proj_dir, args) :
"""build fips project"""
if not util.is_valid_project_dir(proj_dir) :
log.error('must be run in a project directory')
cfg_name = None
build_tool_args = None
if '--' in args:
idx = args.index('--')
build_tool_args = args[(idx + 1):]
args = args[:idx]
if len(args) > 0 :
cfg_name = args[0]
if not cfg_name :
cfg_name = settings.get(proj_dir, 'config')
if cfg_name == 'clean' :
if len(args) > 1:
cfg_name = args[1]
else :
cfg_name = settings.get(proj_dir, 'config')
project.make_clean(fips_dir, proj_dir, cfg_name)
else :
project.build(fips_dir, proj_dir, cfg_name, None, build_tool_args)
#-------------------------------------------------------------------------------
def help() :
"""print build help"""
log.info(log.YELLOW +
"fips build clean [config]\n"
"fips build [-- build tool args]\n"
"fips build [config] [-- build tool args]\n" + log.DEF +
" perform a build for current or named config\n" +
" any args following a -- will be forwarded to the invoked build tool")