Annotation of pkgsrc/lang/python27/patches/patch-Modules_getpath.c, revision 1.3
1.3 ! rodent 1: $NetBSD: patch-Modules_getpath.c,v 1.2 2014/11/02 13:31:11 spz Exp $
1.1 obache 2:
3: * from cygport 2.7.3-getpath-exe-extension.patch
4:
1.3 ! rodent 5: --- Modules/getpath.c.orig 2014-12-10 15:59:55.000000000 +0000
1.1 obache 6: +++ Modules/getpath.c
1.2 spz 7: @@ -451,6 +451,28 @@ calculate_path(void)
1.1 obache 8: if (isxfile(progpath))
9: break;
10:
11: +#ifdef __CYGWIN__
12: + /*
13: + * Cygwin automatically removes the ".exe" extension from argv[0]
14: + * to make programs feel like they are in a more Unix-like
15: + * environment. Unfortunately, this can make it problemmatic for
16: + * Cygwin to distinguish between a directory and an executable with
17: + * the same name excluding the ".exe" extension. For example, the
18: + * Cygwin Python build directory has a "Python" directory and a
19: + * "python.exe" executable. This causes isxfile() to erroneously
20: + * return false. If isdir() returns true and there is enough space
21: + * to append the ".exe" extension, then we try again with the
22: + * extension appended.
23: + */
24: +#define EXE ".exe"
25: + if (isdir(progpath) && strlen(progpath) + strlen(EXE) <= MAXPATHLEN)
26: + {
27: + strcat(progpath, EXE);
28: + if (isxfile(progpath))
29: + break;
30: + }
31: +#endif /* __CYGWIN__ */
32: +
33: if (!delim) {
34: progpath[0] = '\0';
35: break;
CVSweb <webmaster@jp.NetBSD.org>