MCPcopy Create free account
hub / github.com/WasmEdge/WasmEdge / fix_gnu_sparse

Function fix_gnu_sparse

utils/install.py:589–632  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

587
588
589def fix_gnu_sparse(args):
590 # Fix GNUSparseFile.0 folder in macOS if exists
591 global CONST_lib_ext, CONST_lib_dir
592
593 for dir in listdir(args.path):
594 if not isdir(join(args.path, dir)):
595 continue
596 if "GNUSparseFile" in dir:
597 for file in listdir(join(args.path, dir)):
598 if file.endswith(CONST_lib_ext):
599 if isdir(join(args.path, CONST_lib_dir)):
600 shutil.move(
601 join(args.path, dir, file), join(args.path, CONST_lib_dir)
602 )
603 else:
604 logging.error(
605 "%s directory not found", join(args.path, CONST_lib_dir)
606 )
607 try:
608 mkdir(join(args.path, CONST_lib_dir))
609 shutil.move(
610 join(args.path, dir, file),
611 join(args.path, CONST_lib_dir),
612 )
613 except:
614 pass
615 elif (
616 file.endswith(".h")
617 or file.endswith(".hpp")
618 or file.endswith(".inc")
619 ):
620 shutil.move(join(args.path, dir, file), join(args.path, "include"))
621 else:
622 shutil.move(join(args.path, dir, file), join(args.path, "bin"))
623 for sub_dir in listdir(join(args.path, dir)):
624 if not isdir(join(args.path, dir, sub_dir)):
625 continue
626 if "GNUSparseFile" in sub_dir:
627 for file in listdir(join(args.path, dir, sub_dir)):
628 shutil.move(
629 join(args.path, dir, sub_dir, file), join(args.path, dir)
630 )
631 if len(listdir(join(args.path, dir, sub_dir))) == 0:
632 shutil.rmtree(join(args.path, dir, sub_dir))
633
634
635def check_nvcc(platform):

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected