Lines Matching defs:path
20 import os.path
27 def CheckedJoin(output, path):
29 CheckedJoin returns os.path.join(output, path). It does sanity checks to
30 ensure the resulting path is under output, but shouldn't be used on untrusted
33 path = os.path.normpath(path)
34 if os.path.isabs(path) or path.startswith('.'):
35 raise ValueError(path)
36 return os.path.join(output, path)
39 def IterateZip(path):
41 IterateZip opens the zip file at path and returns a generator of
44 with zipfile.ZipFile(path, 'r') as zip_file:
51 def IterateTar(path):
53 IterateTar opens the tar.gz file at path and returns a generator of
56 with tarfile.open(path, 'r:gz') as tar_file:
77 if not os.path.exists(archive):
89 if os.path.exists(output):
96 for path, mode, inp in entries:
98 if '\\' in path or path.startswith('/'):
99 raise ValueError(path)
102 new_prefix, rest = path.split('/', 1)
110 rest = path
114 if not os.path.isdir(os.path.dirname(fixed_path)):
115 os.makedirs(os.path.dirname(fixed_path))