From efa78ba0a0e1f89b92da4fa0fa6e5e029efecf3f Mon Sep 17 00:00:00 2001 From: agronholm Date: Fri, 25 Sep 2009 22:01:27 +0300 Subject: Fix script launcher creation on 64-bit Windows, patch by Jason R. Coombs (http://bugs.python.org/setuptools/issue2) --HG-- branch : distribute extra : rebase_source : 60c07b0639b77a3e8ff13eb12161ebe03ab47430 --- launcher.c | 14 +++++++++++--- msvc-build-launcher.cmd | 15 +++++++++++++++ setuptools/cli-32.exe | Bin 0 -> 65536 bytes setuptools/cli-64.exe | Bin 0 -> 74240 bytes setuptools/cli.exe | Bin 6656 -> 0 bytes setuptools/command/easy_install.py | 5 +++-- setuptools/gui-32.exe | Bin 0 -> 65536 bytes setuptools/gui-64.exe | Bin 0 -> 74240 bytes setuptools/gui.exe | Bin 7168 -> 0 bytes 9 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 msvc-build-launcher.cmd create mode 100644 setuptools/cli-32.exe create mode 100644 setuptools/cli-64.exe delete mode 100755 setuptools/cli.exe create mode 100644 setuptools/gui-32.exe create mode 100644 setuptools/gui-64.exe delete mode 100755 setuptools/gui.exe diff --git a/launcher.c b/launcher.c index c8022505..0dca2e16 100755 --- a/launcher.c +++ b/launcher.c @@ -25,8 +25,9 @@ #include #include -#include +#include #include +#include "tchar.h" #include "windows.h" int fail(char *format, char *data) { @@ -236,11 +237,18 @@ int run(int argc, char **argv, int is_gui) { } /* We *do* need to wait for a CLI to finish, so use spawn */ - return spawnv(P_WAIT, ptr, (const char * const *)(newargs)); + return _spawnv(_P_WAIT, ptr, (const char * const *)(newargs)); } - +/* int WINAPI WinMain(HINSTANCE hI, HINSTANCE hP, LPSTR lpCmd, int nShow) { return run(__argc, __argv, GUI); } +*/ + +int _tmain(int argc, _TCHAR* argv[]) +{ + return run(argc, argv, GUI); +} + diff --git a/msvc-build-launcher.cmd b/msvc-build-launcher.cmd new file mode 100644 index 00000000..3666d723 --- /dev/null +++ b/msvc-build-launcher.cmd @@ -0,0 +1,15 @@ +@echo off + +REM VCVARSALL may be in Program Files or Program Files (x86) +PATH=C:\Program Files\Microsoft Visual Studio 9.0\VC;%PATH% +PATH=C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC;%PATH% + +REM set up the environment to compile to x86 +call VCVARSALL x86 +cl /D "GUI=0" /D "WIN32_LEAN_AND_MEAN" launcher.c /O2 /link /MACHINE:x86 /out:setuptools/cli-32.exe +cl /D "GUI=1" /D "WIN32_LEAN_AND_MEAN" launcher.c /O2 /link /MACHINE:x86 /out:setuptools/gui-32.exe + +REM now for 64-bit +call VCVARSALL x86_amd64 +cl /D "GUI=0" /D "WIN32_LEAN_AND_MEAN" launcher.c /O2 /link /MACHINE:x64 /out:setuptools/cli-64.exe +cl /D "GUI=1" /D "WIN32_LEAN_AND_MEAN" launcher.c /O2 /link /MACHINE:x64 /out:setuptools/gui-64.exe \ No newline at end of file diff --git a/setuptools/cli-32.exe b/setuptools/cli-32.exe new file mode 100644 index 00000000..dd63bbfc Binary files /dev/null and b/setuptools/cli-32.exe differ diff --git a/setuptools/cli-64.exe b/setuptools/cli-64.exe new file mode 100644 index 00000000..cc7ced50 Binary files /dev/null and b/setuptools/cli-64.exe differ diff --git a/setuptools/cli.exe b/setuptools/cli.exe deleted file mode 100755 index 3173b2b2..00000000 Binary files a/setuptools/cli.exe and /dev/null differ diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index 195139c7..4b03e185 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -1603,13 +1603,14 @@ def get_script_args(dist, executable=sys_executable, wininst=False): ")\n" ) % locals() if sys.platform=='win32' or wininst: + word_size = [32, 64]['amd64' in sys.version.lower()] # On Windows/wininst, add a .py extension and an .exe launcher if group=='gui_scripts': - ext, launcher = '-script.pyw', 'gui.exe' + ext, launcher = '-script.pyw', 'gui-%d.exe' % word_size old = ['.pyw'] new_header = re.sub('(?i)python.exe','pythonw.exe',header) else: - ext, launcher = '-script.py', 'cli.exe' + ext, launcher = '-script.py', 'cli-%d.exe' % word_size old = ['.py','.pyc','.pyo'] new_header = re.sub('(?i)pythonw.exe','python.exe',header) diff --git a/setuptools/gui-32.exe b/setuptools/gui-32.exe new file mode 100644 index 00000000..71838207 Binary files /dev/null and b/setuptools/gui-32.exe differ diff --git a/setuptools/gui-64.exe b/setuptools/gui-64.exe new file mode 100644 index 00000000..7fbfb889 Binary files /dev/null and b/setuptools/gui-64.exe differ diff --git a/setuptools/gui.exe b/setuptools/gui.exe deleted file mode 100755 index 53d4ff81..00000000 Binary files a/setuptools/gui.exe and /dev/null differ -- cgit v1.2.1