コード例 #1
0
def _getfullpathname(space, w_path):
    """helper for ntpath.abspath """
    try:
        if space.isinstance_w(w_path, space.w_unicode):
            path = FileEncoder(space, w_path)
            fullpath = rposix.getfullpathname(path)
            w_fullpath = space.wrap(fullpath)
        else:
            path = space.str0_w(w_path)
            fullpath = rposix.getfullpathname(path)
            w_fullpath = space.wrap(fullpath)
    except OSError, e:
        raise wrap_oserror2(space, e, w_path)
コード例 #2
0
ファイル: interp_posix.py プロジェクト: abhinavthomas/pypy
def _getfullpathname(space, w_path):
    """helper for ntpath.abspath """
    try:
        if space.isinstance_w(w_path, space.w_unicode):
            path = FileEncoder(space, w_path)
            fullpath = rposix.getfullpathname(path)
            w_fullpath = space.wrap(fullpath)
        else:
            path = space.str0_w(w_path)
            fullpath = rposix.getfullpathname(path)
            w_fullpath = space.wrap(fullpath)
    except OSError, e:
        raise wrap_oserror2(space, e, w_path)
コード例 #3
0
ファイル: interp_posix.py プロジェクト: zcxowwww/pypy
def _getfullpathname(space, w_path):
    """helper for ntpath.abspath """
    try:
        if space.isinstance_w(w_path, space.w_unicode):
            path = FileEncoder(space, w_path)
            fullpath = rposix.getfullpathname(path)
            w_fullpath = u2utf8(space, fullpath)
        else:
            path = space.bytes0_w(w_path)
            fullpath = rposix.getfullpathname(path)
            w_fullpath = space.newbytes(fullpath)
    except OSError as e:
        raise wrap_oserror2(space, e, w_path)
    else:
        return w_fullpath
コード例 #4
0
ファイル: rpath.py プロジェクト: sota/pypy-old
def _nt_rabspath(path):
    try:
        if path == '':
            path = os.getcwd()
        return rposix.getfullpathname(path)
    except OSError:
        return path
コード例 #5
0
ファイル: rpath.py プロジェクト: abhinavthomas/pypy
def _nt_rabspath(path):
    try:
        if path == '':
            path = os.getcwd()
        return rposix.getfullpathname(path)
    except OSError:
        return path
コード例 #6
0
ファイル: test_rposix.py プロジェクト: abhinavthomas/pypy
 def test__getfullpathname(self):
     posix = __import__(os.name)
     sysdrv = os.getenv('SystemDrive', 'C:')
     stuff = sysdrv + 'stuff'
     data = rposix.getfullpathname(stuff)
     assert data == posix._getfullpathname(stuff)
     # the most intriguing failure of ntpath.py should not repeat, here:
     assert not data.endswith(stuff)
コード例 #7
0
 def test__getfullpathname(self):
     posix = __import__(os.name)
     sysdrv = os.getenv('SystemDrive', 'C:')
     stuff = sysdrv + 'stuff'
     data = rposix.getfullpathname(stuff)
     assert data == posix._getfullpathname(stuff)
     # the most intriguing failure of ntpath.py should not repeat, here:
     assert not data.endswith(stuff)
コード例 #8
0
ファイル: test_rposix.py プロジェクト: hmrg-grmh/pypy
 def test__getfullpathname_long(self):
     stuff = "C:" + "\\abcd" * 100
     py.test.raises(WindowsError, rposix.getfullpathname, stuff)
     ustuff = u"C:" + u"\\abcd" * 100
     res = rposix.getfullpathname(ustuff)
     assert res == ustuff