MCPcopy Create free account
hub / github.com/cztomczak/cefpython / perform_copy_recursively

Function perform_copy_recursively

tools/make_installer.py:259–294  ·  view source on GitHub ↗
(base_dir, relative_dir, new_dir)

Source from the content-addressed store, hash-verified

257
258
259def perform_copy_recursively(base_dir, relative_dir, new_dir):
260 real_dir = os.path.join(base_dir, relative_dir)
261 assert os.path.exists(real_dir) and os.path.isdir(real_dir)
262 assert os.path.exists(new_dir) and os.path.isdir(new_dir)
263
264 # Create subdirectory
265 new_subdir = os.path.join(new_dir, relative_dir)
266 if not os.path.exists(new_subdir):
267 print("[make_installer.py] Create: {dir}"
268 .format(dir=short_dst_path(new_subdir)))
269 os.makedirs(new_subdir)
270
271 # List directory
272 paths = os.listdir(real_dir)
273 for path in paths:
274 # "path" variable contains relative path
275 real_path = os.path.join(real_dir, path)
276 path = os.path.join(relative_dir, path)
277 if os.path.isdir(real_path):
278 if is_ignored_path(real_path):
279 continue
280 perform_copy_recursively(base_dir, path, new_dir)
281 elif os.path.isfile(real_path):
282 if is_ignored_path(real_path):
283 continue
284 new_file = os.path.join(new_dir, path)
285 new_subdir = os.path.dirname(new_file)
286 if os.path.exists(new_file):
287 raise Exception("Path aready exists: {new_file}"
288 .format(new_file=short_dst_path(new_file)))
289 print("[make_installer.py] Copy: {file} ==> {dir}"
290 .format(file=short_src_path(real_path),
291 dir=short_dst_path(new_subdir)))
292 shutil.copy(real_path, new_subdir)
293 else:
294 raise Exception("Unknown path: {path}".format(path=real_path))
295
296
297def is_ignored_path(path):

Callers 1

perform_copy_operationsFunction · 0.85

Calls 4

short_dst_pathFunction · 0.85
is_ignored_pathFunction · 0.85
short_src_pathFunction · 0.85
copyMethod · 0.80

Tested by

no test coverage detected