forked from Turbo87/cabwiz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cabwiz
executable file
·72 lines (53 loc) · 2.06 KB
/
cabwiz
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
#!/usr/bin/python
# http://msdn.microsoft.com/en-us/library/aa924359.aspx
# http://msdn.microsoft.com/en-us/library/bb964579.aspx
import sys
import InfCabGlue
def read_parameters(argv):
if len(argv) < 2:
return {}
if '/help' in argv or '-help' in argv or '--help' in argv:
return {'help': True}
parameters = {'inf-file': argv[1]}
for i in range(len(argv)):
if i < 2:
continue
if (argv[i] == '/v' or argv[i] == '-v'):
parameters['verbose'] = True
continue
if (argv[i] == '/dest' or argv[i] == '-dest') and i + 1 < len(argv):
parameters['dest-dir'] = argv[i + 1]
continue
if (argv[i] == '/err' or argv[i] == '-err') and i + 1 < len(argv):
parameters['err-file'] = argv[i + 1]
continue
if (argv[i] == '/cpu' or argv[i] == '-cpu') and i + 1 < len(argv):
j = i + 1
parameters['cpu-type'] = argv[i + 1]
continue
if (argv[i] == '/platform' or argv[i] == '-platform') and i + 1 < len(argv):
parameters['platform-name'] = argv[i + 1]
continue
return parameters
def print_help():
print '''Usage: python cabwiz.py <inf-file> [/dest <dest-dir>] [/err <err-file>] [/cpu <cpu-type>] [/platform <platform-name] [/v]
inf-file INF source file to use
dest-dir absolute dest dir for CAB files
err-file error file
cpu-type cpu types to support in the INF file
platform-name the name of the platform to support in the INF file
v verbose output'''
def main():
parameters = read_parameters(sys.argv)
if 'help' in parameters:
print_help()
return
if 'inf-file' not in parameters:
print_help()
print
print 'Error: invalid command line parameters'
return
glue = InfCabGlue.InfCabGlue(parameters)
glue.glue()
if __name__ == '__main__':
main()