summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2016-01-14 01:13:39 -0800
committerTodd Gamblin <tgamblin@llnl.gov>2016-01-14 01:13:39 -0800
commit1268b415709356d369dfdd69a5eef6e1b775e851 (patch)
treecb0f9bd4457c862a8bbd9edd3114754dad0d83dc /lib
parent93fdb06d7de790555ed0db1684bbe4906943876a (diff)
parent133fda11f25688f95b0f064c68878dafb4c4324d (diff)
downloadspack-1268b415709356d369dfdd69a5eef6e1b775e851.tar.gz
spack-1268b415709356d369dfdd69a5eef6e1b775e851.tar.bz2
spack-1268b415709356d369dfdd69a5eef6e1b775e851.tar.xz
spack-1268b415709356d369dfdd69a5eef6e1b775e851.zip
Merge pull request #293 from trws/llvm-rework
Llvm rework
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/package.py24
1 files changed, 20 insertions, 4 deletions
diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py
index 84bcb15f7f..fe82d58394 100644
--- a/lib/spack/spack/package.py
+++ b/lib/spack/spack/package.py
@@ -34,7 +34,9 @@ rundown on spack and how it differs from homebrew, look at the
README.
"""
import os
+import errno
import re
+import shutil
import time
import itertools
import subprocess
@@ -696,7 +698,9 @@ class Package(object):
##########
# Stage resources in appropriate path
resources = self._get_resources()
- for resource in resources:
+ # TODO: this is to allow nested resources, a better solution would be
+ # good
+ for resource in sorted(resources, key=lambda res: len(res.destination)):
stage = resource.fetcher.stage
_expand_archive(stage, resource.name)
# Turn placement into a dict with relative paths
@@ -705,11 +709,23 @@ class Package(object):
placement = {'': placement}
# Make the paths in the dictionary absolute and link
for key, value in placement.iteritems():
- link_path = join_path(self.stage.source_path, resource.destination, value)
+ target_path = join_path(self.stage.source_path, resource.destination)
+ link_path = join_path(target_path, value)
source_path = join_path(stage.source_path, key)
+
+ try:
+ os.makedirs(target_path)
+ except OSError as err:
+ if err.errno == errno.EEXIST and os.path.isdir(target_path):
+ pass
+ else: raise
+
+ # NOTE: a reasonable fix for the TODO above might be to have
+ # these expand in place, but expand_archive does not offer
+ # this
+
if not os.path.exists(link_path):
- # Create a symlink
- os.symlink(source_path, link_path)
+ shutil.move(source_path, link_path)
##########
self.stage.chdir_to_source()