Reimplement kill_python. The existing version had a number of flaws, namely, it didn't work for x64 and it wasn't precise about which python_d.exe it was killing -- it just killed the first one it came across that happened to have 'pcbuild\python_d.exe' or 'build\python_d.exe' in it's path. The new version has been rewritten from the ground up and now lives in PCbuild, instead of Tools\buildbot, and it has also been incorporated into the Visual Studio solution (pcbuild.sln) as 'kill_python'. The solution has also been altered such that kill_python is called where necessary in the build process in order to prevent any linking errors due to open file locks. In lieu of this, all of the existing bits and pieces in Tools\buildbot that called out to kill_python at various points have also been removed as they are now obsolete. Tested on both Win32 and x64.

Change set (included to improve usefulness of svnmerge log entry):
M      PCbuild\pythoncore.vcproj
M      PCbuild\pcbuild.sln
M      PCbuild\release.vsprops
A      PCbuild\kill_python.vcproj
M      PCbuild\debug.vsprops
A      PCbuild\kill_python.c
D      Tools\buildbot\kill_python.bat
D      Tools\buildbot\kill_python.mak
M      Tools\buildbot\build.bat
D      Tools\buildbot\Makefile
M      Tools\buildbot\build-amd64.bat
M      Tools\buildbot\buildmsi.bat
D      Tools\buildbot\kill_python.c
This commit is contained in:
Trent Nelson 2008-04-03 18:27:06 +00:00
parent 980c598936
commit d6dffbcc28
13 changed files with 513 additions and 99 deletions

View File

@ -8,4 +8,8 @@
Name="VCCLCompilerTool"
PreprocessorDefinitions="_DEBUG"
/>
</VisualStudioPropertySheet>
<UserMacro
Name="KillPythonExe"
Value="$(OutDir)\kill_python_d.exe"
/>
</VisualStudioPropertySheet>

174
PCbuild/kill_python.c Normal file
View File

@ -0,0 +1,174 @@
/*
* Helper program for killing lingering python[_d].exe processes before
* building, thus attempting to avoid build failures due to files being
* locked.
*/
#include <windows.h>
#include <wchar.h>
#include <tlhelp32.h>
#include <stdio.h>
#pragma comment(lib, "psapi")
#ifdef _DEBUG
#define PYTHON_EXE (L"python_d.exe")
#define PYTHON_EXE_LEN (12)
#define KILL_PYTHON_EXE (L"kill_python_d.exe")
#define KILL_PYTHON_EXE_LEN (17)
#else
#define PYTHON_EXE (L"python.exe")
#define PYTHON_EXE_LEN (10)
#define KILL_PYTHON_EXE (L"kill_python.exe")
#define KILL_PYTHON_EXE_LEN (15)
#endif
int
main(int argc, char **argv)
{
HANDLE hp, hsp, hsm; /* process, snapshot processes, snapshot modules */
DWORD dac, our_pid;
size_t len;
wchar_t path[MAX_PATH+1];
MODULEENTRY32W me;
PROCESSENTRY32W pe;
me.dwSize = sizeof(MODULEENTRY32W);
pe.dwSize = sizeof(PROCESSENTRY32W);
memset(path, 0, MAX_PATH+1);
our_pid = GetCurrentProcessId();
hsm = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, our_pid);
if (hsm == INVALID_HANDLE_VALUE) {
printf("CreateToolhelp32Snapshot[1] failed: %d\n", GetLastError());
return 1;
}
if (!Module32FirstW(hsm, &me)) {
printf("Module32FirstW[1] failed: %d\n", GetLastError());
CloseHandle(hsm);
return 1;
}
/*
* Enumerate over the modules for the current process in order to find
* kill_process[_d].exe, then take a note of the directory it lives in.
*/
do {
if (_wcsnicmp(me.szModule, KILL_PYTHON_EXE, KILL_PYTHON_EXE_LEN))
continue;
len = wcsnlen_s(me.szExePath, MAX_PATH) - KILL_PYTHON_EXE_LEN;
wcsncpy_s(path, MAX_PATH+1, me.szExePath, len);
break;
} while (Module32NextW(hsm, &me));
CloseHandle(hsm);
if (path == NULL) {
printf("failed to discern directory of running process\n");
return 1;
}
/*
* Take a snapshot of system processes. Enumerate over the snapshot,
* looking for python processes. When we find one, verify it lives
* in the same directory we live in. If it does, kill it. If we're
* unable to kill it, treat this as a fatal error and return 1.
*
* The rationale behind this is that we're called at the start of the
* build process on the basis that we'll take care of killing any
* running instances, such that the build won't encounter permission
* denied errors during linking. If we can't kill one of the processes,
* we can't provide this assurance, and the build shouldn't start.
*/
hsp = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (hsp == INVALID_HANDLE_VALUE) {
printf("CreateToolhelp32Snapshot[2] failed: %d\n", GetLastError());
return 1;
}
if (!Process32FirstW(hsp, &pe)) {
printf("Process32FirstW failed: %d\n", GetLastError());
CloseHandle(hsp);
return 1;
}
dac = PROCESS_QUERY_INFORMATION | PROCESS_VM_READ | PROCESS_TERMINATE;
do {
/*
* XXX TODO: if we really wanted to be fancy, we could check the
* modules for all processes (not just the python[_d].exe ones)
* and see if any of our DLLs are loaded (i.e. python30[_d].dll),
* as that would also inhibit our ability to rebuild the solution.
* Not worth loosing sleep over though; for now, a simple check
* for just the python executable should be sufficient.
*/
if (_wcsnicmp(pe.szExeFile, PYTHON_EXE, PYTHON_EXE_LEN))
/* This isn't a python process. */
continue;
/* It's a python process, so figure out which directory it's in... */
hsm = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, pe.th32ProcessID);
if (hsm == INVALID_HANDLE_VALUE) {
printf("CreateToolhelp32Snapshot[3] failed: %d\n", GetLastError());
CloseHandle(hsp);
return 1;
}
if (!Module32FirstW(hsm, &me)) {
printf("Module32FirstW[2] failed: %d\n", GetLastError());
CloseHandle(hsp);
CloseHandle(hsm);
return 1;
}
do {
if (_wcsnicmp(me.szModule, PYTHON_EXE, PYTHON_EXE_LEN))
/* Wrong module, we're looking for python[_d].exe... */
continue;
if (_wcsnicmp(path, me.szExePath, len))
/* Process doesn't live in our directory. */
break;
/* Python process residing in the right directory, kill it! */
hp = OpenProcess(dac, FALSE, pe.th32ProcessID);
if (!hp) {
printf("OpenProcess failed: %d\n", GetLastError());
CloseHandle(hsp);
CloseHandle(hsm);
return 1;
}
if (!TerminateProcess(hp, 1)) {
printf("TerminateProcess failed: %d\n", GetLastError());
CloseHandle(hsp);
CloseHandle(hsm);
CloseHandle(hp);
return 1;
}
CloseHandle(hp);
break;
} while (Module32NextW(hsm, &me));
CloseHandle(hsm);
} while (Process32NextW(hsp, &pe));
CloseHandle(hsp);
return 0;
}
/* vi: set ts=8 sw=4 sts=4 expandtab */

285
PCbuild/kill_python.vcproj Normal file
View File

@ -0,0 +1,285 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="kill_python"
ProjectGUID="{6DE10744-E396-40A5-B4E2-1B69AA7C8D31}"
RootNamespace="kill_python"
Keyword="Win32Proj"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
ConfigurationType="1"
InheritedPropertySheets=".\pyproject.vsprops;.\debug.vsprops"
CharacterSet="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
SubSystem="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
Description="Killing existing Python processes..."
CommandLine="&quot;$(KillPythonExe)&quot;"
/>
</Configuration>
<Configuration
Name="Debug|x64"
ConfigurationType="1"
InheritedPropertySheets=".\pyproject.vsprops;.\debug.vsprops;.\x64.vsprops"
CharacterSet="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
SubSystem="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
Description="Killing existing Python processes..."
CommandLine="&quot;$(KillPythonExe)&quot;"
/>
</Configuration>
<Configuration
Name="Release|Win32"
ConfigurationType="1"
InheritedPropertySheets=".\pyproject.vsprops;.\release.vsprops"
CharacterSet="0"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
SubSystem="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
Description="Killing existing Python processes..."
CommandLine="&quot;$(KillPythonExe)&quot;"
/>
</Configuration>
<Configuration
Name="Release|x64"
ConfigurationType="1"
InheritedPropertySheets=".\pyproject.vsprops;.\release.vsprops;.\x64.vsprops"
CharacterSet="0"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
SubSystem="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
Description="Killing existing Python processes..."
CommandLine="&quot;$(KillPythonExe)&quot;"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
>
<File
RelativePath=".\kill_python.c"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -11,6 +11,7 @@ EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pythoncore", "pythoncore.vcproj", "{CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}"
ProjectSection(ProjectDependencies) = postProject
{F0E0541E-F17D-430B-97C4-93ADF0DD284E} = {F0E0541E-F17D-430B-97C4-93ADF0DD284E}
{6DE10744-E396-40A5-B4E2-1B69AA7C8D31} = {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}
{C73F0EC1-358B-4177-940F-0846AC8B04CD} = {C73F0EC1-358B-4177-940F-0846AC8B04CD}
EndProjectSection
EndProject
@ -20,6 +21,9 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pythonw", "pythonw.vcproj",
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "w9xpopen", "w9xpopen.vcproj", "{E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}"
ProjectSection(ProjectDependencies) = postProject
{6DE10744-E396-40A5-B4E2-1B69AA7C8D31} = {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_buildinfo", "make_buildinfo.vcproj", "{C73F0EC1-358B-4177-940F-0846AC8B04CD}"
EndProject
@ -36,6 +40,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "winsound", "winsound.vcproj
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_bsddb", "_bsddb.vcproj", "{B4D38F3F-68FB-42EC-A45D-E00657BB3627}"
ProjectSection(ProjectDependencies) = postProject
{6DE10744-E396-40A5-B4E2-1B69AA7C8D31} = {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}
{62172C7D-B39E-409A-B352-370FF5098C19} = {62172C7D-B39E-409A-B352-370FF5098C19}
{CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}
EndProjectSection
@ -117,8 +122,16 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_hashlib", "_hashlib.vcproj
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_bsddb44", "_bsddb44.vcproj", "{62172C7D-B39E-409A-B352-370FF5098C19}"
ProjectSection(ProjectDependencies) = postProject
{6DE10744-E396-40A5-B4E2-1B69AA7C8D31} = {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sqlite3", "sqlite3.vcproj", "{A1A295E5-463C-437F-81CA-1F32367685DA}"
ProjectSection(ProjectDependencies) = postProject
{6DE10744-E396-40A5-B4E2-1B69AA7C8D31} = {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "kill_python", "kill_python.vcproj", "{6DE10744-E396-40A5-B4E2-1B69AA7C8D31}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -524,6 +537,22 @@ Global
{A1A295E5-463C-437F-81CA-1F32367685DA}.Release|Win32.Build.0 = Release|Win32
{A1A295E5-463C-437F-81CA-1F32367685DA}.Release|x64.ActiveCfg = Release|x64
{A1A295E5-463C-437F-81CA-1F32367685DA}.Release|x64.Build.0 = Release|x64
{6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Debug|Win32.ActiveCfg = Debug|Win32
{6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Debug|Win32.Build.0 = Debug|Win32
{6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Debug|x64.ActiveCfg = Debug|x64
{6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Debug|x64.Build.0 = Debug|x64
{6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.PGInstrument|Win32.ActiveCfg = Release|Win32
{6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.PGInstrument|Win32.Build.0 = Release|Win32
{6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.PGInstrument|x64.ActiveCfg = Release|x64
{6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.PGInstrument|x64.Build.0 = Release|x64
{6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.PGUpdate|Win32.ActiveCfg = Release|Win32
{6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.PGUpdate|Win32.Build.0 = Release|Win32
{6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.PGUpdate|x64.ActiveCfg = Release|x64
{6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.PGUpdate|x64.Build.0 = Release|x64
{6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Release|Win32.ActiveCfg = Release|Win32
{6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Release|Win32.Build.0 = Release|Win32
{6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Release|x64.ActiveCfg = Release|x64
{6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -58,8 +58,8 @@
/>
<Tool
Name="VCPreLinkEventTool"
Description="generate buildinfo"
CommandLine="&quot;$(SolutionDir)make_buildinfo.exe&quot; $(ConfigurationName)"
Description="Generate build information and kill existing Python processes..."
CommandLine="&quot;$(SolutionDir)make_buildinfo.exe&quot; Release&#x0D;&#x0A;&quot;$(KillPythonExe)&quot;"
/>
<Tool
Name="VCLinkerTool"
@ -133,8 +133,8 @@
/>
<Tool
Name="VCPreLinkEventTool"
Description="generate buildinfo"
CommandLine="$(SolutionDir)make_buildinfo.exe $(ConfigurationName)"
Description="Generate build information and kill existing Python processes..."
CommandLine="&quot;$(SolutionDir)make_buildinfo.exe&quot; Release&#x0D;&#x0A;&quot;$(KillPythonExe)&quot;"
/>
<Tool
Name="VCLinkerTool"
@ -211,8 +211,8 @@
/>
<Tool
Name="VCPreLinkEventTool"
Description="generate buildinfo"
CommandLine="&quot;$(SolutionDir)make_buildinfo.exe&quot; $(ConfigurationName)"
Description="Generate build information and kill existing Python processes..."
CommandLine="&quot;$(SolutionDir)make_buildinfo.exe&quot; Debug&#x0D;&#x0A;&quot;$(KillPythonExe)&quot;"
/>
<Tool
Name="VCLinkerTool"
@ -289,8 +289,8 @@
/>
<Tool
Name="VCPreLinkEventTool"
Description="generate buildinfo"
CommandLine="$(SolutionDir)make_buildinfo.exe $(ConfigurationName)"
Description="Generate build information and kill existing Python processes..."
CommandLine="&quot;$(SolutionDir)make_buildinfo.exe&quot; Debug&#x0D;&#x0A;&quot;$(KillPythonExe)&quot;"
/>
<Tool
Name="VCLinkerTool"
@ -363,8 +363,8 @@
/>
<Tool
Name="VCPreLinkEventTool"
Description="generate buildinfo"
CommandLine="$(SolutionDir)make_buildinfo.exe Release"
Description="Generate build information and kill existing Python processes..."
CommandLine="&quot;$(SolutionDir)make_buildinfo.exe&quot; Release&#x0D;&#x0A;&quot;$(KillPythonExe)&quot;"
/>
<Tool
Name="VCLinkerTool"
@ -438,8 +438,8 @@
/>
<Tool
Name="VCPreLinkEventTool"
Description="generate buildinfo"
CommandLine="$(SolutionDir)make_buildinfo.exe $(ConfigurationName)"
Description="Generate build information and kill existing Python processes..."
CommandLine="&quot;$(SolutionDir)make_buildinfo.exe&quot; Release&#x0D;&#x0A;&quot;$(KillPythonExe)&quot;"
/>
<Tool
Name="VCLinkerTool"
@ -513,8 +513,8 @@
/>
<Tool
Name="VCPreLinkEventTool"
Description="generate buildinfo"
CommandLine="$(SolutionDir)make_buildinfo.exe Release"
Description="Generate build information and kill existing Python processes..."
CommandLine="&quot;$(SolutionDir)make_buildinfo.exe&quot; Release&#x0D;&#x0A;&quot;$(KillPythonExe)&quot;"
/>
<Tool
Name="VCLinkerTool"
@ -588,8 +588,8 @@
/>
<Tool
Name="VCPreLinkEventTool"
Description="generate buildinfo"
CommandLine="$(SolutionDir)make_buildinfo.exe $(ConfigurationName)"
Description="Generate build information and kill existing Python processes..."
CommandLine="&quot;$(SolutionDir)make_buildinfo.exe&quot; Release&#x0D;&#x0A;&quot;$(KillPythonExe)&quot;"
/>
<Tool
Name="VCLinkerTool"

View File

@ -8,4 +8,8 @@
Name="VCCLCompilerTool"
PreprocessorDefinitions="NDEBUG"
/>
<UserMacro
Name="KillPythonExe"
Value="$(OutDir)\kill_python.exe"
/>
</VisualStudioPropertySheet>

View File

@ -1,6 +0,0 @@
all: kill_python.exe
./kill_python.exe
kill_python.exe: kill_python.c
gcc -o kill_python.exe kill_python.c -lpsapi

View File

@ -1,6 +1,5 @@
@rem Used by the buildbot "compile" step.
cmd /c Tools\buildbot\external-amd64.bat
call "%VS90COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64
REM cmd /q/c Tools\buildbot\kill_python.bat
cmd /c Tools\buildbot\clean-amd64.bat
vcbuild PCbuild\pcbuild.sln "Debug|x64"

View File

@ -1,7 +1,6 @@
@rem Used by the buildbot "compile" step.
cmd /c Tools\buildbot\external.bat
call "%VS90COMNTOOLS%vsvars32.bat"
cmd /q/c Tools\buildbot\kill_python.bat
cmd /c Tools\buildbot\clean.bat
vcbuild /useenv PCbuild\pcbuild.sln "Debug|Win32"

View File

@ -5,7 +5,6 @@ cmd /c Tools\buildbot\external.bat
call "%VS90COMNTOOLS%vsvars32.bat"
@rem build Python
cmd /q/c Tools\buildbot\kill_python.bat
vcbuild /useenv PCbuild\pcbuild.sln "Release|Win32"
@rem build the documentation

View File

@ -1,3 +0,0 @@
cd Tools\buildbot
nmake /C /S /f kill_python.mak
kill_python.exe

View File

@ -1,68 +0,0 @@
/* This program looks for processes which have build\PCbuild\python.exe
in their path and terminates them. */
#include <windows.h>
#include <psapi.h>
#include <stdio.h>
int main()
{
DWORD pids[1024], cbNeeded;
int i, num_processes;
if (!EnumProcesses(pids, sizeof(pids), &cbNeeded)) {
printf("EnumProcesses failed\n");
return 1;
}
num_processes = cbNeeded/sizeof(pids[0]);
for (i = 0; i < num_processes; i++) {
HANDLE hProcess;
char path[MAX_PATH];
HMODULE mods[1024];
int k, num_mods;
hProcess = OpenProcess(PROCESS_QUERY_INFORMATION
| PROCESS_VM_READ
| PROCESS_TERMINATE ,
FALSE, pids[i]);
if (!hProcess)
/* process not accessible */
continue;
if (!EnumProcessModules(hProcess, mods, sizeof(mods), &cbNeeded)) {
/* For unknown reasons, this sometimes returns ERROR_PARTIAL_COPY;
this apparently means we are not supposed to read the process. */
if (GetLastError() == ERROR_PARTIAL_COPY) {
CloseHandle(hProcess);
continue;
}
printf("EnumProcessModules failed: %d\n", GetLastError());
return 1;
}
if (!GetModuleFileNameEx(hProcess, NULL, path, sizeof(path))) {
printf("GetProcessImageFileName failed\n");
return 1;
}
_strlwr(path);
/* printf("%s\n", path); */
/* Check if we are running a buildbot version of Python.
On Windows, this will always be a debug build from the
PCbuild directory. build\\PCbuild\\python_d.exe
On Cygwin, the pathname is similar to other Unixes.
Use \\build\\python.exe to ensure we don't match
PCbuild\\python.exe which could be a normal instance
of Python running on vanilla Windows.
*/
if ((strstr(path, "pcbuild\\python_d.exe") != NULL) ||
(strstr(path, "\\build\\python.exe") != NULL)) {
printf("Terminating %s (pid %d)\n", path, pids[i]);
if (!TerminateProcess(hProcess, 1)) {
printf("Termination failed: %d\n", GetLastError());
return 1;
}
return 0;
}
CloseHandle(hProcess);
}
}

View File

@ -1,2 +0,0 @@
kill_python.exe: kill_python.c
cl -nologo -o kill_python.exe kill_python.c psapi.lib