mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-20 03:23:23 +08:00
[0.3.x] changed : target catalogs, setup script
git-svn-id: https://pykd.svn.codeplex.com/svn@90344 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
6133ff57fb
commit
633d304294
@ -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
|
||||
|
@ -76,22 +76,30 @@
|
||||
<TargetExt>.pyd</TargetExt>
|
||||
<PostBuildEventUseInBuild>true</PostBuildEventUseInBuild>
|
||||
<TargetName>$(ProjectName)</TargetName>
|
||||
<IntDir>$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir>$(SolutionDir)out\$(Platform)\$(Configuration)\</OutDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_2.7|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<TargetExt>.pyd</TargetExt>
|
||||
<PostBuildEventUseInBuild>true</PostBuildEventUseInBuild>
|
||||
<TargetName>$(ProjectName)</TargetName>
|
||||
<OutDir>$(SolutionDir)out\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir>$(Platform)\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_2.7|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<TargetExt>.pyd</TargetExt>
|
||||
<TargetName>$(ProjectName)</TargetName>
|
||||
<IntDir>$(SolutionDir)out\$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir>$(SolutionDir)out\$(Platform)\$(Configuration)\</OutDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_2.7|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<TargetExt>.pyd</TargetExt>
|
||||
<TargetName>$(ProjectName)</TargetName>
|
||||
<OutDir>$(SolutionDir)out\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)out\$(Platform)\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug_2.7|Win32'">
|
||||
<ClCompile>
|
||||
@ -108,7 +116,8 @@
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>copy $(ProjectDir)..\Debug\targetapp.exe $(OutDir)targetapp.exe</Command>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
<CustomBuildStep>
|
||||
<Command>
|
||||
@ -130,7 +139,8 @@
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>copy $(ProjectDir)..\x64\Debug\targetapp.exe $(OutDir)targetapp.exe</Command>
|
||||
<Command>
|
||||
</Command>
|
||||
</PostBuildEvent>
|
||||
<CustomBuildStep>
|
||||
<Command>
|
||||
|
@ -1,4 +0,0 @@
|
||||
from pykd import *
|
||||
__version__ = pykd.__version__
|
||||
__file__ = pykd.__file__
|
||||
|
105
setup/setup.py
105
setup/setup.py
@ -1,35 +1,118 @@
|
||||
|
||||
from setuptools import setup
|
||||
from setuptools.dist import Distribution
|
||||
import pkg_resources
|
||||
import argparse
|
||||
import os
|
||||
import shutil
|
||||
import zipfile
|
||||
|
||||
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() )
|
||||
_name = "pykd"
|
||||
_desc = "python windbg extension"
|
||||
_version = '0.3.0.21'
|
||||
|
||||
args = parser.parse_args()
|
||||
def makeWheel(args):
|
||||
|
||||
pkg_dir = { 'win32' : 'pykd_x86', 'win-amd64' : 'pykd_x64' }.get( args.plat_name )
|
||||
# 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
|
||||
|
||||
_name = "pykd"
|
||||
_version = "0.3.0.16"
|
||||
_desc = "python windbg extension"
|
||||
|
||||
setup(
|
||||
name = _name,
|
||||
version = _version,
|
||||
description = _desc,
|
||||
packages = ['pykd'],
|
||||
package_dir = {'pykd': pkg_dir},
|
||||
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)
|
||||
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
<Name>setup</Name>
|
||||
<RootNamespace>setup</RootNamespace>
|
||||
<LaunchProvider>Standard Python launcher</LaunchProvider>
|
||||
<CommandLineArguments>install</CommandLineArguments>
|
||||
<CommandLineArguments>bdist_zip --plat-name=win32</CommandLineArguments>
|
||||
<InterpreterPath />
|
||||
<InterpreterArguments />
|
||||
<EnableNativeCodeDebugging>False</EnableNativeCodeDebugging>
|
||||
|
@ -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
|
||||
|
||||
|
@ -8,21 +8,19 @@
|
||||
<StartupFile>pykdtest.py</StartupFile>
|
||||
<SearchPath>
|
||||
</SearchPath>
|
||||
<WorkingDirectory>..\..\Debug_2.7</WorkingDirectory>
|
||||
<WorkingDirectory>..\..\out\Win32\Debug_2.7</WorkingDirectory>
|
||||
<OutputPath>.</OutputPath>
|
||||
<Name>pykdtest</Name>
|
||||
<RootNamespace>pykdtest</RootNamespace>
|
||||
<LaunchProvider>Standard Python launcher</LaunchProvider>
|
||||
<CommandLineArguments>targetapp.exe</CommandLineArguments>
|
||||
<CommandLineArguments>C:\proj\pykd-rel\out\Win32\Debug\targetapp.exe</CommandLineArguments>
|
||||
<InterpreterPath />
|
||||
<InterpreterArguments>
|
||||
</InterpreterArguments>
|
||||
<EnableNativeCodeDebugging>False</EnableNativeCodeDebugging>
|
||||
<IsWindowsApplication>False</IsWindowsApplication>
|
||||
<InterpreterId>
|
||||
</InterpreterId>
|
||||
<InterpreterVersion>
|
||||
</InterpreterVersion>
|
||||
<InterpreterId>{2af0f10d-7135-4994-9156-5d01c9c11b7e}</InterpreterId>
|
||||
<InterpreterVersion>2.7</InterpreterVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@ -59,5 +57,8 @@
|
||||
<Compile Include="typedvar.py" />
|
||||
<Compile Include="typeinfo.py" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<InterpreterReference Include="{2af0f10d-7135-4994-9156-5d01c9c11b7e}\2.7" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.Common.targets" />
|
||||
</Project>
|
Loading…
Reference in New Issue
Block a user