Add package_dir method to package.py.

This commit is contained in:
Todd Gamblin 2016-06-24 12:33:53 -07:00
parent 65e3ac4132
commit 055f7f4ab6

View File

@ -397,6 +397,12 @@ def __init__(self, spec):
if self.is_extension:
spack.repo.get(self.extendee_spec)._check_extendable()
@property
def package_dir(self):
"""Return the directory where the package.py file lives."""
return os.path.dirname(self.module.__file__)
@property
def global_license_dir(self):
"""Returns the directory where global license files for all
@ -687,7 +693,7 @@ def compiler(self):
"""Get the spack.compiler.Compiler object used to build this package"""
if not self.spec.concrete:
raise ValueError("Can only get a compiler for a concrete package.")
return spack.compilers.compiler_for_spec(self.spec.compiler,
return spack.compilers.compiler_for_spec(self.spec.compiler,
self.spec.architecture)
def url_version(self, version):