Parses the command-line arguments. libfile, deffile = parse_cmd()
()
| 36 | DATA_RE = re.compile(r"^_imp__(.*) in python%s\.dll" % py_ver, re.MULTILINE) |
| 37 | |
| 38 | def parse_cmd(): |
| 39 | """Parses the command-line arguments. |
| 40 | |
| 41 | libfile, deffile = parse_cmd()""" |
| 42 | if len(sys.argv) == 3: |
| 43 | if sys.argv[1][-4:] == '.lib' and sys.argv[2][-4:] == '.def': |
| 44 | libfile, deffile = sys.argv[1:] |
| 45 | elif sys.argv[1][-4:] == '.def' and sys.argv[2][-4:] == '.lib': |
| 46 | deffile, libfile = sys.argv[1:] |
| 47 | else: |
| 48 | print("I'm assuming that your first argument is the library") |
| 49 | print("and the second is the DEF file.") |
| 50 | elif len(sys.argv) == 2: |
| 51 | if sys.argv[1][-4:] == '.def': |
| 52 | deffile = sys.argv[1] |
| 53 | libfile = 'python%s.lib' % py_ver |
| 54 | elif sys.argv[1][-4:] == '.lib': |
| 55 | deffile = None |
| 56 | libfile = sys.argv[1] |
| 57 | else: |
| 58 | libfile = 'python%s.lib' % py_ver |
| 59 | deffile = None |
| 60 | return libfile, deffile |
| 61 | |
| 62 | def getnm(nm_cmd=['nm', '-Cs', 'python%s.lib' % py_ver], shell=True): |
| 63 | """Returns the output of nm_cmd via a pipe. |