From c23b0fb2bfbd8df35ebee9551458ed00e0f2095c Mon Sep 17 00:00:00 2001 From: PJ Eby Date: Sun, 16 Oct 2005 20:45:30 +0000 Subject: Fix problem with Windows console scripts conflicting with module names, thereby confusing the import process. Scripts are now generated with a suffix of the form '-script.py' to avoid conflicts. (The .exe's are still generated without the '-script' part, so you don't have to type it.) Thanks to Matthew R. Scott for reporting the problem. --HG-- branch : setuptools extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/trunk/setuptools%4041261 --- launcher.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'launcher.c') diff --git a/launcher.c b/launcher.c index 69102c13..b5405911 100755 --- a/launcher.c +++ b/launcher.c @@ -12,8 +12,8 @@ To build/rebuild with mingw32, do this in the setuptools project directory: - gcc -DGUI=0 -mno-cygwin -O -s -o setuptools/cli.exe launcher.c - gcc -DGUI=1 -mwindows -mno-cygwin -O -s -o setuptools/gui.exe launcher.c + gcc -DGUI=0 -mno-cygwin -O -s -o setuptools/cli.exe launcher.c + gcc -DGUI=1 -mwindows -mno-cygwin -O -s -o setuptools/gui.exe launcher.c It links to msvcrt.dll, but this shouldn't be a problem since it doesn't actually run Python in the same process. Note that using 'exec' instead @@ -55,7 +55,8 @@ int run(int argc, char **argv, int is_gui) { end = script + strlen(script); while( end>script && *end != '.') *end-- = '\0'; - strcat(script, (GUI ? "pyw" : "py")); + *end-- = '\0'; + strcat(script, (GUI ? "-script.pyw" : "-script.py")); /* figure out the target python executable */ @@ -74,7 +75,6 @@ int run(int argc, char **argv, int is_gui) { *ptr = '\0'; while (ptr>python && isspace(*ptr)) *ptr-- = '\0'; /* strip trailing sp */ - if (strncmp(python, "#!", 2)) { /* default to python.exe if no #! header */ strcpy(python, "#!python.exe"); -- cgit v1.2.1