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.
This commit is contained in:
Ray Donnelly
2015-07-07 22:40:55 +01:00
parent 61bb7eaa7e
commit 7f9cc5b2b3
2 changed files with 26 additions and 14 deletions

View File

@@ -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 <mach-o/dyld.h>
#endif
+#ifdef __CYGWIN__
+#include <sys/cygwin.h>
+#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';

View File

@@ -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}"