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