OXIESEC PANEL
- Current Dir:
/
/
usr
/
lib
/
python3
/
dist-packages
/
numpy
/
distutils
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
10/28/2024 08:45:52 AM
rwxr-xr-x
📄
__config__.py
1.73 KB
12/05/2017 02:32:02 PM
rw-r--r--
📄
__init__.py
747 bytes
09/17/2017 01:29:38 PM
rw-r--r--
📁
__pycache__
-
10/28/2024 08:45:52 AM
rwxr-xr-x
📄
__version__.py
151 bytes
09/17/2017 01:29:38 PM
rw-r--r--
📄
ccompiler.py
27.87 KB
09/29/2017 05:31:46 PM
rw-r--r--
📁
command
-
10/28/2024 08:45:52 AM
rwxr-xr-x
📄
compat.py
218 bytes
09/17/2017 01:29:38 PM
rw-r--r--
📄
conv_template.py
9.48 KB
09/17/2017 01:29:38 PM
rw-r--r--
📄
core.py
7.99 KB
09/17/2017 01:29:38 PM
rw-r--r--
📄
cpuinfo.py
22.45 KB
09/29/2017 05:31:46 PM
rw-r--r--
📄
environment.py
2.29 KB
09/17/2017 01:29:38 PM
rw-r--r--
📄
exec_command.py
8.46 KB
09/17/2017 01:29:38 PM
rw-r--r--
📄
extension.py
2.9 KB
09/17/2017 01:29:38 PM
rw-r--r--
📁
fcompiler
-
10/28/2024 08:45:52 AM
rwxr-xr-x
📄
from_template.py
7.65 KB
09/17/2017 01:29:38 PM
rw-r--r--
📄
info.py
157 bytes
09/17/2017 01:29:38 PM
rw-r--r--
📄
intelccompiler.py
4.19 KB
09/24/2017 10:47:22 PM
rw-r--r--
📄
lib2def.py
3.43 KB
09/17/2017 01:29:38 PM
rw-r--r--
📄
line_endings.py
2 KB
09/17/2017 01:29:38 PM
rw-r--r--
📄
log.py
2.68 KB
09/17/2017 01:29:38 PM
rw-r--r--
📁
mingw
-
10/28/2024 08:45:52 AM
rwxr-xr-x
📄
mingw32ccompiler.py
24.56 KB
09/24/2017 10:47:22 PM
rw-r--r--
📄
misc_util.py
80.05 KB
09/29/2017 05:31:46 PM
rw-r--r--
📄
msvc9compiler.py
2.21 KB
09/17/2017 01:29:38 PM
rw-r--r--
📄
msvccompiler.py
1.94 KB
09/17/2017 01:29:38 PM
rw-r--r--
📄
npy_pkg_config.py
12.93 KB
09/17/2017 01:29:38 PM
rw-r--r--
📄
numpy_distribution.py
700 bytes
09/17/2017 01:29:38 PM
rw-r--r--
📄
pathccompiler.py
779 bytes
09/17/2017 01:29:38 PM
rw-r--r--
📄
setup.py
611 bytes
09/17/2017 01:29:38 PM
rw-r--r--
📄
system_info.py
83.31 KB
09/29/2017 05:31:46 PM
rw-r--r--
📁
tests
-
10/28/2024 08:45:52 AM
rwxr-xr-x
📄
unixccompiler.py
5.04 KB
09/17/2017 01:29:38 PM
rw-r--r--
Editing: lib2def.py
Close
from __future__ import division, absolute_import, print_function 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<py_ver>.lib and output.def defaults to stdout Author: Robert Kern <kernr@mail.ncifcrf.gov> 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, universal_newlines=True) 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)