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
This commit is contained in:
parent
758eba50d9
commit
efa78ba0a0
14
launcher.c
14
launcher.c
|
@ -25,8 +25,9 @@
|
|||
|
||||
#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) {
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -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)
|
||||
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue