1. Tarek Ziadé
  2. distribute


agronholm  committed 99a5e3b

Fix script launcher creation on 64-bit Windows, patch by Jason R. Coombs (http://bugs.python.org/setuptools/issue2)

  • Participants
  • Parent commits 9f1bf05
  • Branches 0.6-maintenance

Comments (0)

Files changed (9)

File launcher.c

View file
 #include <stdlib.h>
 #include <stdio.h>
-#include <unistd.h>
+#include <process.h>
 #include <fcntl.h>
+#include "tchar.h"
 #include "windows.h"
 int fail(char *format, char *data) {
     /* 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);

File msvc-build-launcher.cmd

View file
+@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

File setuptools/cli-32.exe

Binary file added.

File setuptools/cli-64.exe

Binary file added.

File setuptools/cli.exe

Binary file removed.

File setuptools/command/easy_install.py

View file
             ) % 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)
-                    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)

File setuptools/gui-32.exe

Binary file added.

File setuptools/gui-64.exe

Binary file added.

File setuptools/gui.exe

Binary file removed.