Correct Charm++ install procedure (#1957)

Charm++ only creates symbolic links instead of copying files. Correct this.
This commit is contained in:
Erik Schnetter 2016-10-10 12:13:20 -04:00 committed by Todd Gamblin
parent 876c26f658
commit 377ac68690

View file

@ -23,6 +23,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
import os
import platform
import shutil
import sys
@ -169,4 +170,19 @@ def install(self, spec, prefix):
# this wouldn't be difficult.
build = Executable(join_path(".", "build"))
build(target, version, *options)
# Charm++'s install script does not copy files, it only creates
# symbolic links. Fix this.
for dirpath, dirnames, filenames in os.walk(prefix):
for filename in filenames:
filepath = join_path(dirpath, filename)
if os.path.islink(filepath):
tmppath = filepath + ".tmp"
# Skip dangling symbolic links
try:
shutil.copy2(filepath, tmppath)
os.remove(filepath)
os.rename(tmppath, filepath)
except:
pass
shutil.rmtree(join_path(prefix, "tmp"))