summaryrefslogtreecommitdiff
path: root/launcher.c
diff options
context:
space:
mode:
authorPJ Eby <distutils-sig@python.org>2005-10-16 20:45:30 +0000
committerPJ Eby <distutils-sig@python.org>2005-10-16 20:45:30 +0000
commitc23b0fb2bfbd8df35ebee9551458ed00e0f2095c (patch)
tree7b535fe7eab66d13a987f9125d5e177c634ab40b /launcher.c
parent7a635d5195358704e12cc92d83a0b7b802e662da (diff)
downloadpython-setuptools-git-c23b0fb2bfbd8df35ebee9551458ed00e0f2095c.tar.gz
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
Diffstat (limited to 'launcher.c')
-rwxr-xr-xlauncher.c8
1 files changed, 4 insertions, 4 deletions
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");