def _copy_file(self, src, dest, executable, bundle_root):
"""Copies a file into the bundle.
Args:
src: The path to the file or directory that should be added.
dest: The path relative to the bundle root where the file should be
stored.
executable: A Boolean value indicating whether or not the file(s) should
be made executable.
bundle_root: The bundle root directory into which the files should be
added.
"""
full_dest = os.path.join(bundle_root, dest)
if (os.path.isfile(full_dest) and
not filecmp.cmp(full_dest, src, shallow=False)):
raise BundleConflictError(dest)
self._makedirs_safely(os.path.dirname(full_dest))
shutil.copy(src, full_dest)
os.chmod(full_dest, 0755 if executable else 0644)
评论列表
文章目录