/usr/lib64/python2.6/site-packages/numpy/distutils
NameSizeModeActions
command/-0755rm
fcompiler/-0755rm
mingw/-0755rm
tests/-0755rm
ccompiler.py223190644editdlrm
ccompiler.pyc199610644editdlrm
ccompiler.pyo199610644editdlrm
conv_template.py94910644editdlrm
conv_template.pyc95650644editdlrm
conv_template.pyo95650644editdlrm
core.py85240644editdlrm
core.pyc66270644editdlrm
core.pyo66270644editdlrm
cpuinfo.py225140644editdlrm
cpuinfo.pyc442410644editdlrm
cpuinfo.pyo442410644editdlrm
environment.py22680644editdlrm
environment.pyc33840644editdlrm
environment.pyo33840644editdlrm
exec_command.py185490644editdlrm
exec_command.pyc172630644editdlrm
exec_command.pyo158410644editdlrm
extension.py23850644editdlrm
extension.pyc21360644editdlrm
extension.pyo21360644editdlrm
from_template.py78030644editdlrm
from_template.pyc84740644editdlrm
from_template.pyo84740644editdlrm
info.py920644editdlrm
info.pyc2660644editdlrm
info.pyo2660644editdlrm
intelccompiler.py9910644editdlrm
intelccompiler.pyc14380644editdlrm
intelccompiler.pyo14380644editdlrm
interactive.py61450644editdlrm
interactive.pyc58480644editdlrm
interactive.pyo58480644editdlrm
lib2def.py34190644editdlrm
lib2def.pyc38890644editdlrm
lib2def.pyo38890644editdlrm
line_endings.py19690644editdlrm
line_endings.pyc27600644editdlrm
line_endings.pyo27600644editdlrm
log.py24380644editdlrm
log.pyc28720644editdlrm
log.pyo28720644editdlrm
mingw32ccompiler.py181050644editdlrm
mingw32ccompiler.pyc137470644editdlrm
mingw32ccompiler.pyo137470644editdlrm
misc_util.py798370644editdlrm
misc_util.pyc764140644editdlrm
misc_util.pyo758530644editdlrm
npy_pkg_config.py122830644editdlrm
npy_pkg_config.pyc145500644editdlrm
npy_pkg_config.pyo145500644editdlrm
numpy_distribution.py6340644editdlrm
numpy_distribution.pyc9810644editdlrm
numpy_distribution.pyo9810644editdlrm
setup.py5610644editdlrm
setup.pyc8640644editdlrm
setup.pyo8640644editdlrm
setupscons.py5570644editdlrm
setupscons.pyc9090644editdlrm
setupscons.pyo9090644editdlrm
system_info.py709270644editdlrm
system_info.pyc709820644editdlrm
system_info.pyo708440644editdlrm
unixccompiler.py34600644editdlrm
unixccompiler.pyc28930644editdlrm
unixccompiler.pyo28930644editdlrm
__config__.py14990644editdlrm
__config__.pyc16540644editdlrm
__config__.pyo16540644editdlrm
__init__.py4310644editdlrm
__init__.pyc6010644editdlrm
__init__.pyo6010644editdlrm
__version__.py850644editdlrm
__version__.pyc2860644editdlrm
__version__.pyo2860644editdlrm
Edit: /usr/lib64/python2.6/site-packages/numpy/distutils/lib2def.py (3419B)
import re import sys import os import subprocess __doc__ = """This module generates a DEF file from the symbols in an MSVC-compiled DLL import library. It correctly discriminates between data and functions. The data is collected from the output of the program nm(1). Usage: python lib2def.py [libname.lib] [output.def] or python lib2def.py [libname.lib] > output.def libname.lib defaults to python.lib and output.def defaults to stdout Author: Robert Kern Last Update: April 30, 1999 """ __version__ = '0.1a' py_ver = "%d%d" % tuple(sys.version_info[:2]) DEFAULT_NM = 'nm -Cs' DEF_HEADER = """LIBRARY python%s.dll ;CODE PRELOAD MOVEABLE DISCARDABLE ;DATA PRELOAD SINGLE EXPORTS """ % py_ver # the header of the DEF file FUNC_RE = re.compile(r"^(.*) in python%s\.dll" % py_ver, re.MULTILINE) DATA_RE = re.compile(r"^_imp__(.*) in python%s\.dll" % py_ver, re.MULTILINE) def parse_cmd(): """Parses the command-line arguments. libfile, deffile = parse_cmd()""" if len(sys.argv) == 3: if sys.argv[1][-4:] == '.lib' and sys.argv[2][-4:] == '.def': libfile, deffile = sys.argv[1:] elif sys.argv[1][-4:] == '.def' and sys.argv[2][-4:] == '.lib': deffile, libfile = sys.argv[1:] else: print "I'm assuming that your first argument is the library" print "and the second is the DEF file." elif len(sys.argv) == 2: if sys.argv[1][-4:] == '.def': deffile = sys.argv[1] libfile = 'python%s.lib' % py_ver elif sys.argv[1][-4:] == '.lib': deffile = None libfile = sys.argv[1] else: libfile = 'python%s.lib' % py_ver deffile = None return libfile, deffile def getnm(nm_cmd = ['nm', '-Cs', 'python%s.lib' % py_ver]): """Returns the output of nm_cmd via a pipe. nm_output = getnam(nm_cmd = 'nm -Cs py_lib')""" f = subprocess.Popen(nm_cmd, shell=True, stdout=subprocess.PIPE) nm_output = f.stdout.read() f.stdout.close() return nm_output def parse_nm(nm_output): """Returns a tuple of lists: dlist for the list of data symbols and flist for the list of function symbols. dlist, flist = parse_nm(nm_output)""" data = DATA_RE.findall(nm_output) func = FUNC_RE.findall(nm_output) flist = [] for sym in data: if sym in func and (sym[:2] == 'Py' or sym[:3] == '_Py' or sym[:4] == 'init'): flist.append(sym) dlist = [] for sym in data: if sym not in flist and (sym[:2] == 'Py' or sym[:3] == '_Py'): dlist.append(sym) dlist.sort() flist.sort() return dlist, flist def output_def(dlist, flist, header, file = sys.stdout): """Outputs the final DEF file to a file defaulting to stdout. output_def(dlist, flist, header, file = sys.stdout)""" for data_sym in dlist: header = header + '\t%s DATA\n' % data_sym header = header + '\n' # blank line for func_sym in flist: header = header + '\t%s\n' % func_sym file.write(header) if __name__ == '__main__': libfile, deffile = parse_cmd() if deffile is None: deffile = sys.stdout else: deffile = open(deffile, 'w') nm_cmd = [str(DEFAULT_NM), str(libfile)] nm_output = getnm(nm_cmd) dlist, flist = parse_nm(nm_output) output_def(dlist, flist, DEF_HEADER, deffile)