1
from setuptools import setup
2
from wheel.bdist_wheel import bdist_wheel
11
_desc = "python windbg extension"
15
return 'Release_Static_%d.%d' % sys.version_info[0:2]
17
if "bdist_wheel" in sys.argv:
20
build_dir = os.path.join(os.path.curdir, 'build' )
21
if os.path.exists(build_dir):
22
shutil.rmtree(build_dir)
25
package_dir = os.path.join(os.path.curdir, _name )
26
if os.path.exists(package_dir):
27
shutil.rmtree(package_dir)
30
shutil.copy("__init__.py", package_dir)
32
bin_dir = os.path.join( os.path.curdir, '..', 'kdlibcpp/bin')
33
pykd_dir = os.path.join( os.path.curdir, '..', 'out')
34
if "--plat-name=win32" in sys.argv:
35
bin_dir = os.path.join( bin_dir, 'x86')
36
pykd_dir = os.path.join(pykd_dir, 'Win32', getReleaseSrc())
37
elif "--plat-name=win-amd64" in sys.argv:
38
bin_dir = os.path.join( bin_dir, 'x64')
39
pykd_dir = os.path.join(pykd_dir, 'X64', getReleaseSrc())
43
assert(os.path.isdir(bin_dir))
45
for binFile in [ f for f in os.listdir(bin_dir) if not os.path.isdir(f) ]:
46
shutil.copy( os.path.join(bin_dir, binFile), os.path.join(package_dir, binFile) )
48
shutil.copy( os.path.join(pykd_dir, 'pykd.pyd'), os.path.join(package_dir, 'pykd.pyd') )
56
package_dir = {'pykd': package_dir},
57
package_data = { 'pykd' :["*.pyd", "*.dll"]},
58
include_package_data=True,
62
elif "bdist_zip" in sys.argv:
66
if "--plat-name=win32" in sys.argv:
68
elif "--plat-name=win-amd64" in sys.argv:
71
package_dir = os.path.join(os.path.curdir, _name )
72
if os.path.exists(package_dir):
73
shutil.rmtree(package_dir)
76
bin_dir = os.path.join( os.path.curdir, '..', 'kdlibcpp/bin')
77
pykd_dir = os.path.join( os.path.curdir, '..', 'out')
78
if plat_name=="win32":
79
bin_dir = os.path.join( bin_dir, 'x86')
80
pykd_dir = os.path.join(pykd_dir, 'Win32', getReleaseSrc())
81
elif plat_name=="win-amd64":
82
bin_dir = os.path.join( bin_dir, 'x64')
83
pykd_dir = os.path.join(pykd_dir, 'X64', getReleaseSrc())
87
pyver="%d%d" % sys.version_info[0:2]
89
zip_str = "pykd-%s-cp%s-%s" % ( _version, pyver, plat_name )
90
zip_name = zip_str + ".zip"
92
assert(os.path.isdir(bin_dir))
94
for binFile in [ f for f in os.listdir(bin_dir) if not os.path.isdir(f) ]:
95
shutil.copy( os.path.join(bin_dir, binFile), os.path.join(package_dir, binFile) )
97
shutil.copy( os.path.join(pykd_dir, 'pykd.pyd'), os.path.join(package_dir, 'pykd.pyd') )
99
dist_dir = os.path.join(os.path.curdir, 'dist')
100
if not os.path.exists(dist_dir):
103
with zipfile.ZipFile(os.path.join(os.path.curdir, 'dist', zip_name), mode='w' ) as archive:
104
for srcFile in os.listdir(package_dir):
105
print( "zipped %s" % (srcFile) )
106
archive.write( os.path.join(package_dir, srcFile), compress_type = zipfile.ZIP_DEFLATED)
110
elif "bdist_pdb" in sys.argv:
113
pyVersion = ('2.7', '3.5', '3.6', '3.7', '3.8', '3.9', '3.10', '3.11', '3.12')
114
platform = ('Win32', 'x64')
116
pdbFiles = [ os.path.join( platform, 'Release_Static_' + version, 'pykd.pdb') for version, platform in itertools.product( pyVersion, platform ) ]
118
zip_name = "pykd-%s-symbols.zip" % _version
120
with zipfile.ZipFile(os.path.join(os.path.curdir, 'dist', zip_name), mode='w' ) as archive:
121
for pdbFile in pdbFiles:
122
print( "zipped %s" % (pdbFile) )
123
archive.write( os.path.join(os.path.curdir, '..', 'out', pdbFile), pdbFile, compress_type = zipfile.ZIP_DEFLATED)