forked from m3sserschmitt/MakeFile-Creator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path__main__.py
47 lines (35 loc) · 1.22 KB
/
__main__.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
42
43
44
45
46
47
#!/usr/bin/env python3
from makefile_creator.args import parse_arguments
import makefile_creator.makefiles as makefiles
import makefile_creator.config as config
if __name__ == '__main__':
args, user_set_args = parse_arguments()
if args['VERSION']:
print(config.PACKAGE_NAME, config.VERSION)
exit()
if args['CONFIG']:
config.remove_irrelevant(args)
config.export_config(args)
print('[+] Configuration file generated.')
print('[+] Open \'mfc.config.json\' to change settings.')
exit()
if args['CONFIG_UPDATE']:
config.remove_irrelevant(args)
config.update_config(args)
print('[+] Configuration file updated.')
exit()
configuration = {}
if not args['IGNORE_CONFIG_FILE']:
try:
configuration = config.import_config(False)
except FileNotFoundError:
print('[-] Configuration file does not exist.')
exit(1)
for option in args:
try:
if option not in user_set_args:
args[option] = configuration[option]
except KeyError:
continue
makefiles.set_variables(args)
makefiles.create_makefiles()