Add a DIY stage class.

This commit is contained in:
Todd Gamblin 2015-04-08 00:22:34 -07:00
parent ab40d0b1a4
commit 5077a2a343

View File

@ -309,6 +309,39 @@ def destroy(self):
os.chdir(os.path.dirname(self.path))
class DIYStage(object):
"""Simple class that allows any directory to be a spack stage."""
def __init__(self, path):
self.archive_file = None
self.path = path
self.source_path = path
def chdir(self):
if os.path.isdir(self.path):
os.chdir(self.path)
else:
tty.die("Setup failed: no such directory: " + self.path)
def chdir_to_source(self):
self.chdir()
def fetch(self):
tty.msg("No need to fetch for DIY.")
def check(self):
tty.msg("No checksum needed for DIY.")
def expand_archive(self):
tty.msg("Using source directory: %s" % self.source_path)
def restage(self):
tty.die("Cannot restage DIY stage.")
def destroy(self):
# No need to destroy DIY stage.
pass
def _get_mirrors():
"""Get mirrors from spack configuration."""
config = spack.config.get_config()