install_tree, copy_tree can install into existing directory structures (#8289)

Replace use of `shutil.copytree` with `copy_tree` and `install_tree` functions in `llnl.util.filesystem`.

- `copy_tree` copies without setting permissions.  It should be used to copy files around in the build directory.
- `install_tree` copies files and sets permissions.  It should be used to copy files into the installation directory.
- `install` and `copy` are analogous single-file functions.
- add more extensive tests for these functions
- update packages to use these functions.
This commit is contained in:
Adam J. Stewart
2018-08-15 11:30:09 -05:00
committed by Todd Gamblin
parent c0699539d5
commit 73c978ddd9
82 changed files with 422 additions and 344 deletions

View File

@@ -23,7 +23,6 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
import os
import shutil
import copy
from spack import *
@@ -266,8 +265,7 @@ def install(self, spec, prefix):
lib_dir = join_path('lib', cp2k_architecture, cp2k_version)
mkdirp(lib_dir)
try:
shutil.copy(env['LIBSMM_PATH'],
join_path(lib_dir, 'libsmm.a'))
copy(env['LIBSMM_PATH'], join_path(lib_dir, 'libsmm.a'))
except KeyError:
raise KeyError('Point environment variable LIBSMM_PATH to '
'the absolute path of the libsmm.a file')
@@ -315,4 +313,4 @@ def install(self, spec, prefix):
'VERSION={0}'.format(cp2k_version))
env['PWD'] = pwd_backup
exe_dir = join_path('exe', cp2k_architecture)
shutil.copytree(exe_dir, self.prefix.bin)
install_tree(exe_dir, self.prefix.bin)