diff --git a/pykd-0.3-2013.sln b/pykd-0.3-2013.sln index a1e48ea..b7a894a 100644 --- a/pykd-0.3-2013.sln +++ b/pykd-0.3-2013.sln @@ -18,8 +18,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "um", "um", "{EEFC9510-DFA7- samples\um\ldr.py = samples\um\ldr.py EndProjectSection EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{EFB54DEF-ABE9-48E0-8EFB-73CB55B18893}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{D1F1222A-A12B-4FD7-91A0-0AB6393A3169}" ProjectSection(SolutionItems) = preProject .nuget\NuGet.Config = .nuget\NuGet.Config diff --git a/pykd/pykd_vc120.vcxproj b/pykd/pykd_vc120.vcxproj index 77432d8..4832934 100644 --- a/pykd/pykd_vc120.vcxproj +++ b/pykd/pykd_vc120.vcxproj @@ -76,22 +76,30 @@ .pyd true $(ProjectName) + $(Platform)\$(Configuration)\ + $(SolutionDir)out\$(Platform)\$(Configuration)\ true .pyd true $(ProjectName) + $(SolutionDir)out\$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ false .pyd $(ProjectName) + $(SolutionDir)out\$(Platform)\$(Configuration)\ + $(SolutionDir)out\$(Platform)\$(Configuration)\ false .pyd $(ProjectName) + $(SolutionDir)out\$(Platform)\$(Configuration)\ + $(SolutionDir)out\$(Platform)\$(Configuration)\ @@ -108,7 +116,8 @@ %(AdditionalLibraryDirectories) - copy $(ProjectDir)..\Debug\targetapp.exe $(OutDir)targetapp.exe + + @@ -130,7 +139,8 @@ %(AdditionalLibraryDirectories) - copy $(ProjectDir)..\x64\Debug\targetapp.exe $(OutDir)targetapp.exe + + diff --git a/setup/pykd/__init__.py b/setup/pykd/__init__.py deleted file mode 100644 index ecb8d51..0000000 --- a/setup/pykd/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -from pykd import * -__version__ = pykd.__version__ -__file__ = pykd.__file__ - diff --git a/setup/setup.py b/setup/setup.py index fcc001d..8ede833 100644 --- a/setup/setup.py +++ b/setup/setup.py @@ -1,35 +1,118 @@ - from setuptools import setup from setuptools.dist import Distribution import pkg_resources import argparse - -parser = argparse.ArgumentParser() -parser.add_argument('cmd', choices=['bdist_egg', 'bdist', 'bdist_wheel', 'install', 'clean']) -parser.add_argument('--plat-name', default=pkg_resources.get_build_platform() ) - -args = parser.parse_args() - -pkg_dir = { 'win32' : 'pykd_x86', 'win-amd64' : 'pykd_x64' }.get( args.plat_name ) - -class BinaryDistribution(Distribution): - def is_pure(self): - return False +import os +import shutil +import zipfile _name = "pykd" -_version = "0.3.0.16" _desc = "python windbg extension" +_version = '0.3.0.21' -setup( - name = _name, - version = _version, - description = _desc, - packages = ['pykd'], - package_dir = {'pykd': pkg_dir}, - package_data = { 'pykd' :["*.pyd", "*.dll"]}, - include_package_data=True, - zip_safe = False, - distclass = BinaryDistribution, - ) +def makeWheel(args): + + # remove build catalog + build_dir = os.path.join(os.path.curdir, 'build' ) + if os.path.exists(build_dir): + shutil.rmtree(build_dir) + + # make package catalog + package_dir = os.path.join(os.path.curdir, _name ) + if os.path.exists(package_dir): + shutil.rmtree(package_dir) + os.mkdir(package_dir) + + with open(os.path.join(package_dir, '__init__.py'),'w') as f: + f.write("from pykd import *\n") + f.write("__version__ = pykd.__version__\n") + f.write("__file__ = pykd.__file__\n") + + bin_dir = os.path.join( os.path.curdir, '..', 'bin') + pykd_dir = os.path.join( os.path.curdir, '..', 'out') + if args.plat_name == 'win32': + bin_dir = os.path.join( bin_dir, 'x86') + pykd_dir = os.path.join(pykd_dir, 'Win32', 'Release_2.7') + elif args.plat_name == 'win-amd64': + bin_dir = os.path.join( bin_dir, 'x64') + pykd_dir = os.path.join(pykd_dir, 'X64', 'Release_2.7') + else: + assert(0) + + assert(os.path.isdir(bin_dir)) + + for binFile in [ f for f in os.listdir(bin_dir) if not os.path.isdir(f) ]: + shutil.copy( os.path.join(bin_dir, binFile), os.path.join(package_dir, binFile) ) + + shutil.copy( os.path.join(pykd_dir, 'pykd.pyd'), os.path.join(package_dir, 'pykd.pyd') ) + + class BinaryDistribution(Distribution): + def is_pure(self): + return False + + setup( + name = _name, + version = _version, + description = _desc, + packages = ['pykd'], + package_dir = {'pykd': package_dir}, + package_data = { 'pykd' :["*.pyd", "*.dll"]}, + include_package_data=True, + zip_safe = False, + distclass = BinaryDistribution, + ) + +def makeZip(args): + + # make package catalog + package_dir = os.path.join(os.path.curdir, _name ) + if os.path.exists(package_dir): + shutil.rmtree(package_dir) + os.mkdir(package_dir) + + bin_dir = os.path.join( os.path.curdir, '..', 'bin') + pykd_dir = os.path.join( os.path.curdir, '..', 'out') + if args.plat_name == 'win32': + bin_dir = os.path.join( bin_dir, 'x86') + pykd_dir = os.path.join(pykd_dir, 'Win32', 'Release_2.7') + elif args.plat_name == 'win-amd64': + bin_dir = os.path.join( bin_dir, 'x64') + pykd_dir = os.path.join(pykd_dir, 'X64', 'Release_2.7') + else: + assert(0) + + zip_str = "pykd-%s-py27-%s.zip" % ( _version, args.plat_name ) + zip_name = zip_str + ".zip" + + assert(os.path.isdir(bin_dir)) + + for binFile in [ f for f in os.listdir(bin_dir) if not os.path.isdir(f) ]: + shutil.copy( os.path.join(bin_dir, binFile), os.path.join(package_dir, binFile) ) + + shutil.copy( os.path.join(pykd_dir, 'pykd.pyd'), os.path.join(package_dir, 'pykd.pyd') ) + + with zipfile.ZipFile(os.path.join(os.path.curdir, 'dist', zip_name), mode='w' ) as archive: + for srcFile in os.listdir(package_dir): + print "zipped %s" % (srcFile) + archive.write( os.path.join(package_dir, srcFile), compress_type = zipfile.ZIP_DEFLATED) + + print "OK" + + + + +parser = argparse.ArgumentParser() + +subparsers = parser.add_subparsers() +wheelParser = subparsers.add_parser('bdist_wheel') +wheelParser.add_argument('--plat-name', choices = ['win32', 'win-amd64'], default=pkg_resources.get_build_platform() ) +wheelParser.set_defaults(func=makeWheel) + +zipParser = subparsers.add_parser('bdist_zip') +zipParser.add_argument('--plat-name', choices = ['win32', 'win-amd64'], default=pkg_resources.get_build_platform() ) +zipParser.set_defaults(func=makeZip) + +args = parser.parse_args() +args.func(args) diff --git a/setup/setup.pyproj b/setup/setup.pyproj index 53c0394..e82d780 100644 --- a/setup/setup.pyproj +++ b/setup/setup.pyproj @@ -13,7 +13,7 @@ setup setup Standard Python launcher - install + bdist_zip --plat-name=win32 False diff --git a/test/scripts/pykdtest.py b/test/scripts/pykdtest.py index a53d91e..7409f62 100644 --- a/test/scripts/pykdtest.py +++ b/test/scripts/pykdtest.py @@ -7,9 +7,7 @@ import os import unittest # Dynamically append current pykd.pyd path to PYTHONPATH -sys.path.insert(0, os.path.dirname(sys.argv[1])) - -print os.path.abspath(os.curdir) +sys.path.insert(0, os.path.abspath(os.curdir) ) import pykd diff --git a/test/scripts/pykdtest.pyproj b/test/scripts/pykdtest.pyproj index dddf552..2a4a7d4 100644 --- a/test/scripts/pykdtest.pyproj +++ b/test/scripts/pykdtest.pyproj @@ -8,21 +8,19 @@ pykdtest.py - ..\..\Debug_2.7 + ..\..\out\Win32\Debug_2.7 . pykdtest pykdtest Standard Python launcher - targetapp.exe + C:\proj\pykd-rel\out\Win32\Debug\targetapp.exe False False - - - - + {2af0f10d-7135-4994-9156-5d01c9c11b7e} + 2.7 true @@ -59,5 +57,8 @@ + + + \ No newline at end of file