at master 1.7 kB view raw
1--- origsrc/Modules/getpath.c.orig 2012-11-27 12:07:56.098645900 -0500 2+++ src/Modules/getpath.c 2012-11-27 12:10:11.254895900 -0500 3@@ -436,6 +436,28 @@ 4 if (isxfile(progpath)) 5 break; 6 7+#ifdef __CYGWIN__ 8+ /* 9+ * Cygwin automatically removes the ".exe" extension from argv[0] 10+ * to make programs feel like they are in a more Unix-like 11+ * environment. Unfortunately, this can make it problemmatic for 12+ * Cygwin to distinguish between a directory and an executable with 13+ * the same name excluding the ".exe" extension. For example, the 14+ * Cygwin Python build directory has a "Python" directory and a 15+ * "python.exe" executable. This causes isxfile() to erroneously 16+ * return false. If isdir() returns true and there is enough space 17+ * to append the ".exe" extension, then we try again with the 18+ * extension appended. 19+ */ 20+#define EXE ".exe" 21+ if (isdir(progpath) && strlen(progpath) + strlen(EXE) <= MAXPATHLEN) 22+ { 23+ strcat(progpath, EXE); 24+ if (isxfile(progpath)) 25+ break; 26+ } 27+#endif /* __CYGWIN__ */ 28+ 29 if (!delim) { 30 progpath[0] = '\0'; 31 break;