Lines Matching full:os
9 import os.path
12 """Like os.path.join but doesn't treat absolute RHS specially"""
13 return os.path.normpath("/".join(paths))
28 return os.path.relpath(dest, src)
32 if not os.path.islink(path):
34 link = os.readlink(path)
35 if not os.path.isabs(link):
54 os.remove(path)
55 os.symlink(base, path)
64 for walkroot, dirs, files in os.walk(basedir):
66 path = os.path.join(walkroot, file)
67 if not os.path.islink(path):
69 link = os.readlink(path)
70 if not os.path.isabs(link):
72 walkdir = os.path.dirname(path.rpartition(basedir)[2])
73 base = os.path.relpath(link, walkdir)
75 os.remove(path)
76 os.symlink(base, path)
99 if os.path.isdir(src) and not len(os.listdir(src)):
104 for root, dirs, files in os.walk(src):
106 testfile = os.path.join(root, files[0])
111 os.link(testfile, os.path.join(dst, 'testfile'))
112 os.unlink(os.path.join(dst, 'testfile'))
123 if os.path.isdir(src):
130 s_dir = os.getcwd()
131 cmd = 'cp -afl --preserve=xattr %s %s' % (source, os.path.realpath(dst))
140 os.link(src, dst)
155 os.unlink(name)
167 os.symlink(source, destination)
169 if e.errno != errno.EEXIST or os.readlink(destination) != source:
176 for root, dirs, files in os.walk(dir, **walkoptions):
178 yield os.path.join(root, file)
183 return (file + os.path.sep).startswith(root)
190 for d in rel_path.split(os.path.sep):
194 if d == os.path.pardir: # '..'
197 start = os.path.dirname(start)
202 (start, have_dir) = __realpath(os.path.join(start, d),
210 while os.path.islink(file) and len(file) >= len(root):
215 target = os.path.normpath(os.readlink(file))
217 if not os.path.isabs(target):
218 tdir = os.path.dirname(file)
226 is_dir = os.path.isdir(file)
240 root = os.path.normpath(root)
241 file = os.path.normpath(file)
243 if not root.endswith(os.path.sep):
245 root = root + os.path.sep
276 pth_abs = os.path.abspath(pth)
277 if not pth_abs.endswith(os.sep):
278 pth_abs += os.sep
290 def which_wild(pathname, path=None, mode=os.F_OK, *, reverse=False, candidates=False):
298 paths = (path or os.environ.get('PATH', os.defpath)).split(':')
304 if not os.path.isabs(element):
305 element = os.path.abspath(element)
307 candidate = os.path.join(element, pathname)
311 if not os.access(found_path, mode):
313 rel = os.path.relpath(found_path, element)
317 files.append((found_path, [os.path.join(p, rel) for p in paths[:index+1]]))
325 each path using os.path.realpath() and return the resulting paths as a
331 # are passed through os.path.realpath(), it will cause them to be prefixed
341 canonical_paths.append(os.path.realpath(path) + trailing_slash)