python 2+3: consider C:\ and C:/ as absolute dirs (os.path.isabs)

This commit is contained in:
Ray Donnelly
2014-02-21 14:30:34 +00:00
parent b3a06661a3
commit 34401f299c
4 changed files with 60 additions and 9 deletions

View File

@@ -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.

View File

@@ -1,8 +1,9 @@
# Maintainer: Alexey Pavlov <Alexpux@gmail.com>
# Contributor: Ray Donnelly <mingw.android@gmail.com>
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