diff options
author | Todd Gamblin <tgamblin@llnl.gov> | 2016-06-17 14:28:39 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-17 14:28:39 -0700 |
commit | 0bbbfc2ef7f91494e057a525718c466c74dca830 (patch) | |
tree | 634d50d5897efd34315a98365d48bbceb2a9d224 /lib | |
parent | f351e011d1f91372492651829b9dd82d81cd191d (diff) | |
parent | 582d01784aa44024da598187c654947bfd2e55de (diff) | |
download | spack-0bbbfc2ef7f91494e057a525718c466c74dca830.tar.gz spack-0bbbfc2ef7f91494e057a525718c466c74dca830.tar.bz2 spack-0bbbfc2ef7f91494e057a525718c466c74dca830.tar.xz spack-0bbbfc2ef7f91494e057a525718c466c74dca830.zip |
Merge pull request #946 from LLNL/features/intel2
Intel software packages and license enhancements
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/hooks/licensing.py | 5 | ||||
-rw-r--r-- | lib/spack/spack/package.py | 14 |
2 files changed, 14 insertions, 5 deletions
diff --git a/lib/spack/spack/hooks/licensing.py b/lib/spack/spack/hooks/licensing.py index 0f63b0e05a..9010b84154 100644 --- a/lib/spack/spack/hooks/licensing.py +++ b/lib/spack/spack/hooks/licensing.py @@ -26,7 +26,7 @@ import os import spack import llnl.util.tty as tty -from llnl.util.filesystem import join_path +from llnl.util.filesystem import join_path, mkdirp def pre_install(pkg): @@ -154,6 +154,9 @@ def symlink_license(pkg): target = pkg.global_license_file for filename in pkg.license_files: link_name = join_path(pkg.prefix, filename) + license_dir = os.path.dirname(link_name) + if not os.path.exists(license_dir): + mkdirp(license_dir) if os.path.exists(target): os.symlink(target, link_name) tty.msg("Added local symlink %s to global license file" % diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py index 1a6c289bc7..98fd51b262 100644 --- a/lib/spack/spack/package.py +++ b/lib/spack/spack/package.py @@ -398,13 +398,19 @@ class Package(object): spack.repo.get(self.extendee_spec)._check_extendable() @property + def global_license_dir(self): + """Returns the directory where global license files for all + packages are stored.""" + spack_root = ancestor(__file__, 4) + return join_path(spack_root, 'etc', 'spack', 'licenses') + + @property def global_license_file(self): - """Returns the path where a global license file should be stored.""" + """Returns the path where a global license file for this + particular package should be stored.""" if not self.license_files: return - spack_root = ancestor(__file__, 4) - global_license_dir = join_path(spack_root, 'etc', 'spack', 'licenses') - return join_path(global_license_dir, self.name, + return join_path(self.global_license_dir, self.name, os.path.basename(self.license_files[0])) @property |