diff -urN Python-2.7.10.orig/Modules/getpath.c Python-2.7.10/Modules/getpath.c --- Python-2.7.10.orig/Modules/getpath.c 2015-07-07 12:58:16.162926800 +0100 +++ Python-2.7.10/Modules/getpath.c 2015-07-07 13:09:22.496926800 +0100 @@ -10,6 +10,10 @@ #include #endif +#ifdef __CYGWIN__ +#include +#endif + /* Search in some common locations for the associated Python libraries. * * Two directories must be found, the platform independent directory @@ -229,8 +233,21 @@ static void copy_absolute(char *path, char *p) { +#if defined(__CYGWIN__) + int win_drive = (p[0] != '\0' && p[1] == ':') ? 1 : 0; + if (p[0] == SEP || win_drive) +#else if (p[0] == SEP) +#endif strcpy(path, p); +#if defined(__CYGWIN__) + /* Turn absolute paths with Windows drive letters into their + Cygwin equivalent since sys.path can't have drive seps (:) + in since those delimit path list entries */ + if (win_drive) { + cygwin_conv_path(CCP_WIN_A_TO_POSIX, p, path, MAXPATHLEN + 1); + } +#endif else { if (!getcwd(path, MAXPATHLEN)) { /* unable to get the current directory */ @@ -482,7 +499,11 @@ } else progpath[0] = '\0'; +#if defined(__MSYS__) + if (progpath[0] != SEP && progpath[0] != '\0' && progpath[1] != ':') +#else if (progpath[0] != SEP && progpath[0] != '\0') +#endif absolutize(progpath); strncpy(argv0_path, progpath, MAXPATHLEN); argv0_path[MAXPATHLEN] = '\0';