From 34401f299c16cf0836c7263d455f821e4c9cb3a5 Mon Sep 17 00:00:00 2001 From: Ray Donnelly Date: Fri, 21 Feb 2014 14:30:34 +0000 Subject: [PATCH] python 2+3: consider C:\ and C:/ as absolute dirs (os.path.isabs) --- ....6-allow-win-drives-in-os-path-isabs.patch | 15 ++++++++++ python2/PKGBUILD | 12 +++++--- ....3-allow-win-drives-in-os-path-isabs.patch | 29 +++++++++++++++++++ python3/PKGBUILD | 13 +++++---- 4 files changed, 60 insertions(+), 9 deletions(-) create mode 100644 python2/2.7.6-allow-win-drives-in-os-path-isabs.patch create mode 100644 python3/3.3.3-allow-win-drives-in-os-path-isabs.patch diff --git a/python2/2.7.6-allow-win-drives-in-os-path-isabs.patch b/python2/2.7.6-allow-win-drives-in-os-path-isabs.patch new file mode 100644 index 00000000..223ac80f --- /dev/null +++ b/python2/2.7.6-allow-win-drives-in-os-path-isabs.patch @@ -0,0 +1,15 @@ +--- a/Lib/posixpath.py 2014-02-21 10:34:28.539709900 +0000 ++++ b/Lib/posixpath.py 2014-02-21 10:37:02.070491400 +0000 +@@ -58,7 +58,11 @@ + + def isabs(s): + """Test whether a path is absolute""" +- return s.startswith('/') ++ return s.startswith('/') or \ ++ (sys.platform == 'msys' and \ ++ len(s) > 2 and \ ++ s[1] == ':' and \ ++ (s[2] == os.sep or s[2] == '\\')) + + + # Join pathnames. diff --git a/python2/PKGBUILD b/python2/PKGBUILD index 92c0c59b..7771c3a8 100644 --- a/python2/PKGBUILD +++ b/python2/PKGBUILD @@ -1,8 +1,9 @@ # Maintainer: Alexey Pavlov +# Contributor: Ray Donnelly pkgname=python2 pkgver=2.7.6 -pkgrel=1 +pkgrel=2 _pybasever=2.7 pkgdesc="A high-level scripting language" arch=('i686' 'x86_64') @@ -28,7 +29,8 @@ source=(http://www.python.org/ftp/python/${pkgver%rc?}/Python-${pkgver}.tar.xz 2.7.5-dylib.patch 2.7.5-dbm.patch 2.7.5-ctypes-util-find_library.patch - 2.7.5-allow-windows-paths-for-executable.patch) + 2.7.5-allow-windows-paths-for-executable.patch + 2.7.6-allow-win-drives-in-os-path-isabs.patch) sha1sums=('8321636af2acbeaa68fc635d7dda7369ed446a80' '76474752d5b84ad78d53f418d554b5c706fcbca7' '2b5f115573d089801f023c16bacc08963f039272' @@ -44,7 +46,8 @@ sha1sums=('8321636af2acbeaa68fc635d7dda7369ed446a80' 'eaf864af38e8b2bd3952ca9e7fbb6efb6191b792' 'f6e392723ed2a4b7fe0138522baa0e0f7b8b3660' 'efbee46e7f1485985409db0f25adbb18ecb4a4ae' - 'fb78069fadcf5394ba380e26e371ad687d344415') + 'fb78069fadcf5394ba380e26e371ad687d344415' + '7e53560390aff658bbbb9384bef6b1871bffda14') prepare() { cd "${srcdir}/Python-${pkgver}" @@ -66,7 +69,8 @@ prepare() { # Incomplete patch from Ray Donnelly # patch -p1 -i ${srcdir}/2.7.5-allow-windows-paths-for-executable.patch - + patch -p1 -i ${srcdir}/2.7.6-allow-win-drives-in-os-path-isabs.patch + # Temporary workaround for FS#22322 # See http://bugs.python.org/issue10835 for upstream report sed -i "/progname =/s/python/python${_pybasever}/" Python/pythonrun.c diff --git a/python3/3.3.3-allow-win-drives-in-os-path-isabs.patch b/python3/3.3.3-allow-win-drives-in-os-path-isabs.patch new file mode 100644 index 00000000..1f4656e1 --- /dev/null +++ b/python3/3.3.3-allow-win-drives-in-os-path-isabs.patch @@ -0,0 +1,29 @@ +--- a/Lib/posixpath.py 2013-11-27 06:57:57.000000000 +0000 ++++ b/Lib/posixpath.py 2014-02-21 10:43:34.423932700 +0000 +@@ -41,6 +41,12 @@ + else: + return '/' + ++def _get_altsep(path): ++ if isinstance(path, bytes): ++ return b'\\' ++ else: ++ return '\\' ++ + # Normalize the case of a pathname. Trivial in Posix, string.lower on Mac. + # On MS-DOS this may also turn slashes into backslashes; however, other + # normalizations (such as optimizing '../' away) are not allowed +@@ -61,7 +67,12 @@ + def isabs(s): + """Test whether a path is absolute""" + sep = _get_sep(s) +- return s.startswith(sep) ++ altsep = _get_altsep(s) ++ return s.startswith(sep) or \ ++ (sys.platform == 'msys' and \ ++ len(s) > 2 and \ ++ s[1] == ':' and \ ++ (s[2] == sep or s[2] == altsep)) + + + # Join pathnames. diff --git a/python3/PKGBUILD b/python3/PKGBUILD index fb96095f..73003417 100644 --- a/python3/PKGBUILD +++ b/python3/PKGBUILD @@ -1,8 +1,9 @@ # Maintainer: Alexey Pavlov +# Contributor: Ray Donnelly pkgname=python pkgver=3.3.3 -pkgrel=1 +pkgrel=2 _pybasever=3.3 pkgdesc="Next generation of the python high-level scripting language" arch=('i686' 'x86_64') @@ -32,7 +33,8 @@ source=(http://www.python.org/ftp/python/${pkgver%rc*}/Python-${pkgver}.tar.xz 3.3-tkinter.patch 3.3.2-allow-windows-paths-for-executable.patch 3.3.2-cygwin-siginfo.patch - python-3.3.2-msys2.patch) + python-3.3.2-msys2.patch + 3.3.3-allow-win-drives-in-os-path-isabs.patch) sha1sums=('af4e75a34bd538c79b9871227c2e7f56569ac107' 'd1bef43a80fbc99524fe599dabb84977fc4f458d' '92109d70e398605c075cd969a89a7f16abd1ce59' @@ -51,8 +53,8 @@ sha1sums=('af4e75a34bd538c79b9871227c2e7f56569ac107' 'b303a2da60abded2ca020dfb63da5d5184c1d92f' 'd3cbd7286fab191a5a9086cea1a9a3dc386e17da' '1ec44391e21ad83cd149e83e65b2e77af13b9fbd' - '4f5ef705c8806900313480e13fb8d34c49aeb77a') - + '4f5ef705c8806900313480e13fb8d34c49aeb77a' + 'e0f3d9388e888357a920c32a4ca525ef4ec69343') prepare() { cd "${srcdir}/Python-${pkgver}" @@ -77,7 +79,8 @@ prepare() { patch -p1 -i ${srcdir}/3.3.2-cygwin-siginfo.patch # Incomplete patch from Ray Donnelly # patch -p1 -i ${srcdir}/3.3.2-allow-windows-paths-for-executable.patch - + patch -p1 -i ${srcdir}/33.3.3-allow-win-drives-in-os-path-isabs.patch + # Ensure that we are using the system copy of various libraries (expat, zlib and libffi), # rather than copies shipped in the tarball rm -r Modules/expat