From 7f9cc5b2b3e57fa037403192d4ac565f50fcb25c Mon Sep 17 00:00:00 2001 From: Ray Donnelly Date: Tue, 7 Jul 2015 22:40:55 +0100 Subject: [PATCH] python2: Fix sys.prefix in a Cygwin friendly way The same issue is can be reproduced on Cygwin so re-implement the msys2-specific fix using cygwin_conv_path() instead. --- ...x-sys-prefix-when-win-drive-in-argv0.patch | 36 ++++++++++++------- python2/PKGBUILD | 4 +-- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/python2/0260-fix-sys-prefix-when-win-drive-in-argv0.patch b/python2/0260-fix-sys-prefix-when-win-drive-in-argv0.patch index 19fcdd67..11219c3b 100644 --- a/python2/0260-fix-sys-prefix-when-win-drive-in-argv0.patch +++ b/python2/0260-fix-sys-prefix-when-win-drive-in-argv0.patch @@ -1,28 +1,40 @@ 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-06 13:16:43.261177500 +0100 -+++ Python-2.7.10/Modules/getpath.c 2015-07-06 13:17:53.505177500 +0100 -@@ -229,8 +229,20 @@ +--- 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(__MSYS__) -+ if (p[0] == SEP || (p[0] != '\0' && p[1] == ':')) ++#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(__MSYS__) -+ /* Turn C:* into /c* since sys.path can't have drive seps (:) in -+ since those delimit path list entries. */ -+ if (path[0] != '\0' && path[1] == ':') { -+ path[1]=tolower(path[0]); -+ path[0]='/'; ++#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 +494,11 @@ +@@ -482,7 +499,11 @@ } else progpath[0] = '\0'; diff --git a/python2/PKGBUILD b/python2/PKGBUILD index 844cdaef..be7a07d2 100644 --- a/python2/PKGBUILD +++ b/python2/PKGBUILD @@ -3,7 +3,7 @@ pkgname=python2 pkgver=2.7.10 -pkgrel=2 +pkgrel=3 _pybasever=2.7 pkgdesc="A high-level scripting language" arch=('i686' 'x86_64') @@ -45,7 +45,7 @@ sha1sums=('ee5a50c5562e7448f037d35fdedc18d95c748b9e' 'a1806da6956df1860cc23ff3701cd80cbb126b87' 'e6e13cb541efaaf228355cb1d7d5cd8574757c72' '80975639f5ad78fd15b8f81bd98fb460c4ee05c4' - '6aa9ec9e99b75725a2f4de681ea8dbd0b2cad2e6') + '6f3a97afc9bb1a688010241203b9598f34a47eea') prepare() { cd "${srcdir}/Python-${pkgver}"