| OLD | NEW |
| (Empty) | |
| 1 #!/usr/bin/python |
| 2 # Generates MSVC import libraries from .def files. Assumes MSVC environment |
| 3 # has been loaded. |
| 4 |
| 5 import optparse |
| 6 import os |
| 7 import subprocess |
| 8 |
| 9 def main(): |
| 10 parser = optparse.OptionParser(usage='usage: %prog [options] input') |
| 11 parser.add_option('-o', |
| 12 '--output', |
| 13 dest='output', |
| 14 default=None, |
| 15 help=('output location')) |
| 16 (options, args) = parser.parse_args() |
| 17 |
| 18 if options.output == None: |
| 19 parser.error('Output location not specified') |
| 20 if len(args) == 0: |
| 21 parser.error('No inputs specified') |
| 22 |
| 23 # Make sure output directory exists. |
| 24 if not os.path.exists(options.output): |
| 25 os.makedirs(options.output) |
| 26 |
| 27 # Run lib.exe on each input def file. |
| 28 for input_path in args: |
| 29 input_name = os.path.basename(input_path) |
| 30 input_root = os.path.splitext(input_name)[0] |
| 31 output_path = os.path.join(options.output, input_root + '.lib') |
| 32 subprocess.call(['lib', '/nologo', '/machine:X86', '/def:' + input_path, |
| 33 '/out:' + output_path]) |
| 34 |
| 35 if __name__ == '__main__': |
| 36 main() |
| OLD | NEW |