##// END OF EJS Templates
py3: convert os.readlink() path to native strings on Windows...
Matt Harbison -
r39940:5fe0b880 default
parent child Browse files
Show More
@@ -223,7 +223,7 b' class gnuarch_source(common.converter_so'
223 def _getfile(self, name, rev):
223 def _getfile(self, name, rev):
224 mode = os.lstat(os.path.join(self.tmppath, name)).st_mode
224 mode = os.lstat(os.path.join(self.tmppath, name)).st_mode
225 if stat.S_ISLNK(mode):
225 if stat.S_ISLNK(mode):
226 data = os.readlink(os.path.join(self.tmppath, name))
226 data = util.readlink(os.path.join(self.tmppath, name))
227 if mode:
227 if mode:
228 mode = 'l'
228 mode = 'l'
229 else:
229 else:
@@ -43,6 +43,7 b' except AttributeError:'
43 def oslink(src, dst):
43 def oslink(src, dst):
44 raise OSError(errno.EINVAL,
44 raise OSError(errno.EINVAL,
45 'hardlinks not supported: %s to %s' % (src, dst))
45 'hardlinks not supported: %s to %s' % (src, dst))
46 readlink = os.readlink
46 unlink = os.unlink
47 unlink = os.unlink
47 rename = os.rename
48 rename = os.rename
48 removedirs = os.removedirs
49 removedirs = os.removedirs
@@ -112,6 +112,7 b' parsepatchoutput = platform.parsepatchou'
112 pconvert = platform.pconvert
112 pconvert = platform.pconvert
113 poll = platform.poll
113 poll = platform.poll
114 posixfile = platform.posixfile
114 posixfile = platform.posixfile
115 readlink = platform.readlink
115 rename = platform.rename
116 rename = platform.rename
116 removedirs = platform.removedirs
117 removedirs = platform.removedirs
117 samedevice = platform.samedevice
118 samedevice = platform.samedevice
@@ -1841,7 +1842,7 b' def makelock(info, pathname):'
1841
1842
1842 def readlock(pathname):
1843 def readlock(pathname):
1843 try:
1844 try:
1844 return os.readlink(pathname)
1845 return readlink(pathname)
1845 except OSError as why:
1846 except OSError as why:
1846 if why.errno not in (errno.EINVAL, errno.ENOSYS):
1847 if why.errno not in (errno.EINVAL, errno.ENOSYS):
1847 raise
1848 raise
@@ -206,7 +206,7 b' class abstractvfs(object):'
206 return util.rename(srcpath, dstpath)
206 return util.rename(srcpath, dstpath)
207
207
208 def readlink(self, path):
208 def readlink(self, path):
209 return os.readlink(self.join(path))
209 return util.readlink(self.join(path))
210
210
211 def removedirs(self, path=None):
211 def removedirs(self, path=None):
212 """Remove a leaf directory and all empty intermediate ones
212 """Remove a leaf directory and all empty intermediate ones
@@ -519,6 +519,9 b' def groupname(gid=None):'
519 If gid is None, return the name of the current group."""
519 If gid is None, return the name of the current group."""
520 return None
520 return None
521
521
522 def readlink(pathname):
523 return pycompat.fsencode(os.readlink(pycompat.fsdecode(pathname)))
524
522 def removedirs(name):
525 def removedirs(name):
523 """special version of os.removedirs that does not remove symlinked
526 """special version of os.removedirs that does not remove symlinked
524 directories or junction points if they actually contain files"""
527 directories or junction points if they actually contain files"""
General Comments 0
You need to be logged in to leave comments. Login now