diff options
author | Trent Nelson <trent.nelson@snakebite.org> | 2008-04-03 18:27:06 (GMT) |
---|---|---|
committer | Trent Nelson <trent.nelson@snakebite.org> | 2008-04-03 18:27:06 (GMT) |
commit | d6dffbcc285ff3eb30eb30ad27616bbafceb1ce0 (patch) | |
tree | d7b90ac669042e6fa813290a8c8779c310394d96 /Tools | |
parent | 980c598936a4b63f80361e6441d2157cae0dd6c4 (diff) | |
download | cpython-d6dffbcc285ff3eb30eb30ad27616bbafceb1ce0.zip cpython-d6dffbcc285ff3eb30eb30ad27616bbafceb1ce0.tar.gz cpython-d6dffbcc285ff3eb30eb30ad27616bbafceb1ce0.tar.bz2 |
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
Diffstat (limited to 'Tools')
-rw-r--r-- | Tools/buildbot/Makefile | 6 | ||||
-rw-r--r-- | Tools/buildbot/build-amd64.bat | 1 | ||||
-rw-r--r-- | Tools/buildbot/build.bat | 1 | ||||
-rw-r--r-- | Tools/buildbot/buildmsi.bat | 1 | ||||
-rw-r--r-- | Tools/buildbot/kill_python.bat | 3 | ||||
-rw-r--r-- | Tools/buildbot/kill_python.c | 68 | ||||
-rw-r--r-- | Tools/buildbot/kill_python.mak | 2 |
7 files changed, 0 insertions, 82 deletions
diff --git a/Tools/buildbot/Makefile b/Tools/buildbot/Makefile deleted file mode 100644 index 1660231..0000000 --- a/Tools/buildbot/Makefile +++ /dev/null @@ -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 - diff --git a/Tools/buildbot/build-amd64.bat b/Tools/buildbot/build-amd64.bat index 0425d19..1d828eb 100644 --- a/Tools/buildbot/build-amd64.bat +++ b/Tools/buildbot/build-amd64.bat @@ -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" diff --git a/Tools/buildbot/build.bat b/Tools/buildbot/build.bat index 5087981..6bac3ed 100644 --- a/Tools/buildbot/build.bat +++ b/Tools/buildbot/build.bat @@ -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" diff --git a/Tools/buildbot/buildmsi.bat b/Tools/buildbot/buildmsi.bat index 249a8d0..5625d65 100644 --- a/Tools/buildbot/buildmsi.bat +++ b/Tools/buildbot/buildmsi.bat @@ -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 diff --git a/Tools/buildbot/kill_python.bat b/Tools/buildbot/kill_python.bat deleted file mode 100644 index d78b6d4..0000000 --- a/Tools/buildbot/kill_python.bat +++ /dev/null @@ -1,3 +0,0 @@ -cd Tools\buildbot -nmake /C /S /f kill_python.mak -kill_python.exe diff --git a/Tools/buildbot/kill_python.c b/Tools/buildbot/kill_python.c deleted file mode 100644 index 5ba450f..0000000 --- a/Tools/buildbot/kill_python.c +++ /dev/null @@ -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); - } -} diff --git a/Tools/buildbot/kill_python.mak b/Tools/buildbot/kill_python.mak deleted file mode 100644 index 6027d3f..0000000 --- a/Tools/buildbot/kill_python.mak +++ /dev/null @@ -1,2 +0,0 @@ -kill_python.exe: kill_python.c - cl -nologo -o kill_python.exe kill_python.c psapi.lib |