Lines Matching refs:os

19 import os
42 if os.path.isabs(template_file_path) \
43 and (not isdir and os.path.isfile(template_file_path)):
44 return os.path.abspath(template_file_path)
47 if not os.path.isfile(template_file_path) and template_file_path.startswith("/"):
55 folder = os.path.abspath(EnvPool.resource_path)
64 folder = os.path.abspath(ecotest_resource_path)
83 if os.path.isabs(resource_file_path) \
84 and ((isdir is None and os.path.exists(resource_file_path))
85 or (not isdir and os.path.isfile(resource_file_path))
86 or (isdir and os.path.isdir(resource_file_path))):
87 return os.path.abspath(resource_file_path)
92 folder = os.path.abspath(EnvPool.resource_path)
102 folder = os.path.abspath(ecotest_resource_path)
111 folder = os.path.abspath(DeccVariable.project.resource_path)
119 folder = os.path.abspath(DeccVariable.project.test_suite_path)
127 folder = os.path.abspath(get_project_path())
143 folder_file = os.path.join(folder, folder_file_path)
144 if (isdir is None and os.path.exists(folder_file)) \
145 or (not isdir and os.path.isfile(folder_file)) \
146 or (isdir and os.path.isdir(folder_file)):
147 return os.path.abspath(folder_file)
149 if not os.path.exists(folder):
152 for child in os.listdir(folder):
156 folder_file = os.path.join(folder, child)
157 if os.path.isdir(folder_file):
159 and folder_file.endswith(os.sep + folder_file_path):
166 elif os.path.isfile(folder_file) \
167 and folder_file.endswith(os.sep + folder_file_path) \
176 flags = os.O_WRONLY | os.O_CREAT
178 dir_path = os.path.dirname(file_path)
179 if not os.path.isdir(dir_path):
180 os.makedirs(dir_path)
181 with os.fdopen(os.open(file_path, flags, modes), mode) as fout:
191 flags = os.O_RDONLY
193 with os.fdopen(os.open(file_path, flags, modes), mode) as fout:
215 full_path = os.path.abspath(os.path.expanduser(create_path))
216 if not os.path.exists(full_path):
217 os.makedirs(full_path, exist_ok=True) # exist_ok=True
224 dirname = os.path.dirname(filename)
225 if not os.path.isdir(dirname):
226 os.makedirs(dirname)
232 os.remove(filename)
235 if os.path.isfile(filename):
237 os.remove(filename)
242 if os.path.isfile(filename):
248 if os.path.isfile(filename):
256 if os.path.isdir(dirname):
260 if os.path.isdir(dirname):
266 if os.path.isdir(dirname):
273 src = os.path.normpath(src)
274 des = os.path.normpath(des)
275 if not os.path.exists(src):
278 if not os.path.exists(des):
280 if not os.path.isdir(des):
284 if not os.path.isdir(src):
287 os.chdir(src)
288 src_file_list = [os.path.join(src, src_file)
289 for src_file in os.listdir(des)]
291 if os.path.isfile(source):
293 if os.path.isdir(source):
294 _, src_name = os.path.split(source)
295 shutil.copytree(source, os.path.join(des, src_name))
303 if os.path.isfile(src):
305 elif os.path.isdir(src):
316 flags = os.O_RDONLY | os.O_BINARY
318 flags = os.O_RDONLY
319 fd = os.open(file_name, flags, 0o644)
321 with os.fdopen(fd, mode="rb") as f:
354 if not os.path.exists(extract_to):
355 os.makedirs(extract_to)