MCPcopy
hub / github.com/ray-project/ray / copy_file

Function copy_file

python/setup.py:705–722  ·  view source on GitHub ↗
(target_dir, filename, rootdir)

Source from the content-addressed store, hash-verified

703
704
705def copy_file(target_dir, filename, rootdir):
706 # TODO(rkn): This feels very brittle. It may not handle all cases. See
707 # https://github.com/apache/arrow/blob/master/python/setup.py for an
708 # example.
709 # File names can be absolute paths, e.g. from _walk_thirdparty_dir().
710 source = os.path.relpath(filename, rootdir)
711 destination = os.path.join(target_dir, source)
712 # Create the target directory if it doesn't already exist.
713 os.makedirs(os.path.dirname(destination), exist_ok=True)
714 if not os.path.exists(destination):
715 if sys.platform == "win32":
716 # Does not preserve file mode (needed to avoid read-only bit)
717 shutil.copyfile(source, destination, follow_symlinks=True)
718 else:
719 # Preserves file mode (needed to copy executable bit)
720 shutil.copy(source, destination, follow_symlinks=True)
721 return 1
722 return 0
723
724
725def pip_run(build_ext):

Callers 1

pip_runFunction · 0.85

Calls 3

existsMethod · 0.80
copyMethod · 0.65
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…