'Creates the stage directory.
If get_tmp_root() is None, the stage directory is created
directly under spack.stage_path, otherwise this will attempt to
create a stage in a temporary directory and link it into
spack.stage_path.
Spack will use the first writable location in spack.tmp_dirs
to create a stage. If there is no valid location in tmp_dirs,
fall back to making the stage inside spack.stage_path.'

def create(self):

    mkdirp(spack.stage_path)
    remove_if_dead_link(self.path)
    if self._need_to_create_path():
        tmp_root = get_tmp_root()
        if (tmp_root is not None):
            tmp_dir = tempfile.mkdtemp('', _stage_prefix, tmp_root)
            tty.debug(('link    %s    ->    %s' % (self.path, tmp_dir)))
            os.symlink(tmp_dir, self.path)
        else:
            mkdirp(self.path)
    ensure_access(self.path)
