| 1 | #!/usr/bin/env python2
|
| 2 | from __future__ import print_function
|
| 3 | """
|
| 4 | c_module_srcs.py
|
| 5 | """
|
| 6 |
|
| 7 | import sys
|
| 8 |
|
| 9 |
|
| 10 | def main(argv):
|
| 11 | manifest_path = argv[1]
|
| 12 | discovered = argv[2]
|
| 13 |
|
| 14 | manifest = {}
|
| 15 | with open(manifest_path) as f:
|
| 16 | for line in f:
|
| 17 | line = line.strip()
|
| 18 | mod_name, rel_path = line.split(None, 2)
|
| 19 | manifest[mod_name] = rel_path
|
| 20 |
|
| 21 | #print(manifest, file=sys.stderr)
|
| 22 |
|
| 23 | with open(discovered) as f:
|
| 24 | for line in f:
|
| 25 | line = line.strip()
|
| 26 | mod_name, _ = line.split(None, 2)
|
| 27 |
|
| 28 | # Hard-coded special cases for now.
|
| 29 |
|
| 30 | if mod_name in ('libc', 'fastlex', 'line_input'): # Our own modules
|
| 31 | # Relative to Python-2.7.13 dir
|
| 32 | print('../pyext/%s.c' % mod_name)
|
| 33 |
|
| 34 | elif mod_name == 'fanos':
|
| 35 | print('../pyext/%s.c' % mod_name)
|
| 36 | print('../cpp/fanos_shared.c')
|
| 37 |
|
| 38 | elif mod_name == 'fastfunc':
|
| 39 | print('../pyext/%s.c' % mod_name)
|
| 40 | print('../data_lang/j8_libc.c')
|
| 41 |
|
| 42 | elif mod_name == 'posix_':
|
| 43 | print('../pyext/posixmodule.c')
|
| 44 |
|
| 45 | elif mod_name == 'math':
|
| 46 | print('Modules/mathmodule.c')
|
| 47 | print('Modules/_math.c')
|
| 48 |
|
| 49 | # Hm OPy needs these for hashlib in 'opy dis-md5'. OK fine.
|
| 50 | elif mod_name == '_md5':
|
| 51 | print('Modules/md5module.c')
|
| 52 | print('Modules/md5.c')
|
| 53 | elif mod_name == '_sha':
|
| 54 | print('Modules/shamodule.c')
|
| 55 | elif mod_name == '_sha256':
|
| 56 | print('Modules/sha256module.c')
|
| 57 | elif mod_name == '_sha512':
|
| 58 | print('Modules/sha512module.c')
|
| 59 |
|
| 60 | elif mod_name == '_io':
|
| 61 | # This data is in setup.py and Modules/Setup.dist.
|
| 62 | #_io -I$(srcdir)/Modules/_io _io/bufferedio.c _io/bytesio.c
|
| 63 | # _io/fileio.c _io/iobase.c _io/_iomodule.c _io/stringio.c
|
| 64 | # _io/textio.c
|
| 65 | print('Modules/_io/bufferedio.c')
|
| 66 | print('Modules/_io/bytesio.c')
|
| 67 | print('Modules/_io/fileio.c')
|
| 68 | print('Modules/_io/iobase.c')
|
| 69 | print('Modules/_io/_iomodule.c')
|
| 70 | print('Modules/_io/stringio.c')
|
| 71 | print('Modules/_io/textio.c')
|
| 72 |
|
| 73 | else:
|
| 74 | print(manifest[mod_name])
|
| 75 |
|
| 76 |
|
| 77 | if __name__ == '__main__':
|
| 78 | try:
|
| 79 | main(sys.argv)
|
| 80 | except RuntimeError as e:
|
| 81 | print('FATAL: %s' % e, file=sys.stderr)
|
| 82 | sys.exit(1)
|
| 83 |
|
| 84 | # vim: ts=2
|