From 22a56a89c7814b3e7386fa01528a58fe91ea3a4f Mon Sep 17 00:00:00 2001 From: "Dr. Christian Tacke" <58549698+ChristianTackeGSI@users.noreply.github.com> Date: Thu, 20 Feb 2020 06:09:26 +0100 Subject: Use shutil.copy2 in install_tree (#15058) Sometimes one needs to preserve the (relative order) of mtimes on installed files. So it's better to just copy over all the metadata from the source tree to the install tree. If permissions need fixing, that will be done anyway afterwards. One major use case are resource()s: They're unpacked in one place and then copied to their final place using install_tree(). If the resource is a source tree using autoconf/automake, resetting mtimes uncorrectly might force unwanted autoconf/etc calls. --- lib/spack/llnl/util/filesystem.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/spack/llnl/util/filesystem.py b/lib/spack/llnl/util/filesystem.py index 273840a424..b4bb23d444 100644 --- a/lib/spack/llnl/util/filesystem.py +++ b/lib/spack/llnl/util/filesystem.py @@ -456,7 +456,7 @@ def copy_tree(src, dest, symlinks=True, ignore=None, _permissions=False): if os.path.isdir(s): mkdirp(d) else: - shutil.copyfile(s, d) + shutil.copy2(s, d) if _permissions: set_install_permissions(d) -- cgit v1.2.3-60-g2f50